<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><script>(()=>{const e=navigator.serviceWorker;e?e.register("/sw.js").then((async e=>{console.log("SWPP 注册成功");try{await e.periodicSync.register("update",{minInterval:864e5})}catch(e){console.log("Periodic Sync 注册失败",e)}})).catch((e=>console.error("SWPP 注册失败",e))):console.warn("当前浏览器不支持 SW")})()</script><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><title>本地实现HEXO文章AI摘要 | LiuShen's Blog</title><meta name="author" content="LiuShen"><meta name="copyright" content="LiuShen"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="robots" content="index, follow"><meta name="description" content="五一假期结束啦！这五天啥也没干，就在宿舍敲代码，都快无聊死了，恰逢找到了一些免费API，就自己实现一个AI摘要吧！利用API生成摘要文本放在文章头部，再通过hexo进行渲染就好啦！"><meta property="og:type" content="article"><meta property="og:title" content="本地实现HEXO文章AI摘要"><meta property="og:url" content="https://blog.liushen.fun/posts/40702a0d/"><meta property="og:site_name" content="LiuShen's Blog"><meta property="og:description" content="五一假期结束啦！这五天啥也没干，就在宿舍敲代码，都快无聊死了，恰逢找到了一些免费API，就自己实现一个AI摘要吧！利用API生成摘要文本放在文章头部，再通过hexo进行渲染就好啦！"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://p.liiiu.cn/i/2025/05/06/6819cd4532457.webp"><meta property="article:published_time" content="2025-05-06T16:00:21.000Z"><meta property="article:modified_time" content="2025-05-06T16:01:21.000Z"><meta property="article:author" content="LiuShen"><meta property="article:tag" content="功能"><meta property="article:tag" content="插件"><meta property="article:tag" content="教程"><meta property="article:tag" content="Hexo"><meta property="article:tag" content="博客管理"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://p.liiiu.cn/i/2025/05/06/6819cd4532457.webp"><link rel="shortcut icon" href="/favicon.ico"><link rel="canonical" href="https://blog.liushen.fun/posts/40702a0d/"><link rel="preconnect" href="https://jsd.liiiu.cn"><meta name="baidu-site-verification" content="codeva-i2bF9bXDJs"><meta name="sogou_site_verification" content="1rIjtK6RhE"><meta name="360-site-verification" content="b9a9f96ae38a1932a326f8ba255cc74b"><meta name="msvalidate.01" content="F7C246820EB04DD140494C98F93A97C7"><meta name="google-site-verification" content="VH3ZE6m42MZDqpTY2tD-XoxDt9iUj2HoiC3W2neB7F4"><link rel="manifest" href="/manifest.json"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/config/img/pwa/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/config/img/pwa/favicon-16x16.png"><link rel="mask-icon" href="/config/img/pwa/favicon-mask.svg" color="#5bbad5"><link rel="stylesheet" href="/css/index.css?v=5.0.0"><link rel="stylesheet" href="/css/custom.css?v=5.0.0"><link rel="stylesheet" href="https://jsd.liiiu.cn/npm/@fortawesome/fontawesome-free@6.7.2/css/all.min.css"><link rel="stylesheet" href="https://jsd.liiiu.cn/npm/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.min.css" media="print" onload='this.media="all"'><script>(()=>{const e={set:(e,t,o)=>{if(!o)return;const n=Date.now()+864e5*o;localStorage.setItem(e,JSON.stringify({value:t,expiry:n}))},get:e=>{const t=localStorage.getItem(e);if(!t)return;const{value:o,expiry:n}=JSON.parse(t);if(!(Date.now()>n))return o;localStorage.removeItem(e)}};window.btf={saveToLocal:e,getScript:(e,t={})=>new Promise(((o,n)=>{const a=document.createElement("script");a.src=e,a.async=!0,Object.entries(t).forEach((([e,t])=>a.setAttribute(e,t))),a.onload=a.onreadystatechange=()=>{a.readyState&&!/loaded|complete/.test(a.readyState)||o()},a.onerror=n,document.head.appendChild(a)})),getCSS:(e,t)=>new Promise(((o,n)=>{const a=document.createElement("link");a.rel="stylesheet",a.href=e,t&&(a.id=t),a.onload=a.onreadystatechange=()=>{a.readyState&&!/loaded|complete/.test(a.readyState)||o()},a.onerror=n,document.head.appendChild(a)})),addGlobalFn:(e,t,o=!1,n=window)=>{const a=n.globalFn||{};a[e]=a[e]||{},o&&a[e][o]||(a[e][o||Object.keys(a[e]).length]=t,n.globalFn=a)}};const t=()=>{document.documentElement.setAttribute("data-theme","dark"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#0d0d0d")},o=()=>{document.documentElement.setAttribute("data-theme","light"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#ffffff")};btf.activateDarkMode=t,btf.activateLightMode=o;const n=e.get("theme"),a=(new Date).getHours();void 0===n?a<=6||a>=18?t():o():"light"===n?o():t();const r=e.get("aside-status");void 0!==r&&document.documentElement.classList.toggle("hide-aside","hide"===r);/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)&&document.documentElement.classList.add("apple")})()</script><script>const GLOBAL_CONFIG={root:"/",algolia:{appId:"7IX3UBC6JW",apiKey:"4ac2846352e499675081f1277fb961c1",indexName:"My Blog",hitsPerPage:6,languages:{input_placeholder:"搜索全站文章",hits_empty:"未找到符合您查询的内容：${query}",hits_stats:"找到 ${hits} 条结果，耗时 ${time} 毫秒"}},localSearch:void 0,translate:{defaultEncoding:2,translateDelay:0,msgToTraditionalChinese:"繁",msgToSimplifiedChinese:"簡"},noticeOutdate:{limitDay:365,position:"top",messagePrev:"本篇文章从发布到现在已经隔了",messageNext:"天了，里面的内容可能过期了，你要自己甄别一下哟👉👈"},highlight:{plugin:"highlight.js",highlightCopy:!0,highlightLang:!0,highlightHeightLimit:400,highlightFullpage:!1,highlightMacStyle:!0},copy:{success:"😋复制啦！请注意版权信息呀！",error:"😪呜呜，复制失败了！",noSupport:"🤐浏览器不支持呢，你用的啥玩意？"},relativeDate:{homepage:!1,post:!1},runtime:"天",dateSuffix:{just:"刚刚",min:"分钟前",hour:"小时前",day:"天前",month:"个月前"},copyright:{limitCount:1e3,languages:{author:"作者: LiuShen",link:"链接: ",source:"来源: LiuShen's Blog",info:"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},lightbox:"fancybox",Snackbar:{chs_to_cht:"已切换为繁体中文",cht_to_chs:"已切换为简体中文",day_to_night:"已切换为深色模式",night_to_day:"已切换为浅色模式",bgLight:"rgba(255, 255, 255, 0.509)",bgDark:"rgba(48, 48, 48, 0.509)",position:"top-right"},infinitegrid:{js:"https://jsd.liiiu.cn/npm/@egjs/infinitegrid@4.12.0/dist/infinitegrid.min.js",buttonText:"加载更多"},isPhotoFigcaption:!0,islazyload:!0,isAnchor:!1,percent:{toc:!0,rightside:!1},autoDarkmode:!1}</script><script id="config-diff">var GLOBAL_CONFIG_SITE={title:"本地实现HEXO文章AI摘要",isPost:!0,isHome:!1,isHighlightShrink:void 0,isToc:!0,postUpdate:"2025-05-07 00:01:21"}</script><link rel="stylesheet" href="https://jsd.liiiu.cn/gh/willow-god/Sharding-fonts/Yozai-Medium/result.min.css"><link rel="stylesheet" href="/config/memos/memos.css"><script defer src="/sw-dom.js"></script><link rel="stylesheet" href="https://jsd.liiiu.cn/npm/swiper@11.1.14/swiper-bundle.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="/config/swiper/swiperstyle.css" media="print" onload='this.media="all"'><meta name="generator" content="Hexo 7.3.0"><link rel="alternate" href="/atom.xml" title="LiuShen's Blog" type="application/atom+xml"></head><body><div class="float-box right top"></div><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><img class="load-image" src="" data-lazy-src="/config/img/preloader.gif" alt=""></div><script async>(()=>{const e=document.getElementById("loading-box"),d=document.body,t=()=>{d.style.overflow="",e.classList.add("loaded")},n=()=>{d.style.overflow="hidden",e.classList.remove("loaded")};n();let o=!1;window.addEventListener("load",(()=>{o||(t(),o=!0)})),setTimeout((()=>{o||(t(),o=!0)}),5e3),window.addEventListener("load",(()=>{t()})),setTimeout((function(){t()}),3e3),document.getElementById("loading-box").addEventListener("click",(()=>{t()})),document.addEventListener("pjax:send",(()=>{n()})),document.addEventListener("pjax:complete",(()=>{t()}))})()</script><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="add-menu-container"><div id="travellings"><a class="site-page" href="https://www.travellings.cn/go.html" title="友链接力-随机开往" target="_blank" rel="noopener nofollow"><i class="fa-solid fa-bus fa-fw"></i></a></div><div id="ten-years"><a class="site-page" href="https://foreverblog.cn/go.html" title="友链接力-十年之约" target="_blank" rel="noopener nofollow"><i class="fa-brands fa-nfc-symbol fa-fw"></i></a></div></div><div class="is-center" id="sidebar-avatar"><div class="avatar-img is-center"><img class="mood-icon" src="" data-lazy-src="https://p.liiiu.cn/i/2025/03/14/67d301461a24a.webp" alt="🤤" onerror='this.onerror=null,this.src="/img/friend_404.gif"'><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/03/13/67d2fc82d329c.webp" onerror='this.onerror=null,this.src="/img/friend_404.gif"' alt="avatar"></div><div class="author-info__name">LiuShen</div></div><div class="site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">72</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">98</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/willow-god"><i class="fab fa-github"></i><span>Follow Me 🛫</span></a><div class="menus_items visible"><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fas fa-home"></i> <span>导航</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.liushen.fun/"><i class="fa-fw fa-solid fa-house-flag"></i> <span>个人主页</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://xc.liushen.fun/"><i class="fa-fw fa fa-camera-retro"></i> <span>个人相册</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa fa-graduation-cap"></i> <span>整理</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i> <span>时光卷轴</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i> <span>文章标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i> <span>文章分类</span></a></li><li><a class="site-page child" href="/charts/"><i class="fa-fw fa-solid fa-chart-pie"></i> <span>文章通览</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa-solid fa-user-group"></i> <span>友人</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/link/"><i class="fa-fw fas fa-link"></i> <span>友链展示</span></a></li><li><a class="site-page child" href="/addlink/"><i class="fa-fw fa fa-at"></i> <span>友链申请</span></a></li><li><a class="site-page child" href="/fcircle/"><i class="fa-fw fa-solid fa-circle-nodes"></i> <span>朋友动态</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa fa-paper-plane"></i> <span>留言</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/comment/"><i class="fa-fw fa-solid fa-chalkboard"></i> <span>留言白板</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://mm.liushen.fun/"><i class="fa-fw fa-solid fa-pen-nib"></i> <span>提笔摘星</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa-solid fa-stethoscope"></i> <span>分享</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="https://gist.liushen.fun/"><i class="fa-fw fa-solid fa-code"></i> <span>代码片段</span></a></li><li><a class="site-page child" href="/subscribe/"><i class="fa-fw fa-solid fa-rss"></i> <span>订阅本站</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://pan.liushen.fun/"><i class="fa-fw fa-solid fa-laptop-file"></i> <span>清羽云盘</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa fa-list"></i> <span>关于</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/about/"><i class="fa-fw fa fa-address-card"></i> <span>站长资料</span></a></li><li><a class="site-page child" href="/shuoshuo/"><i class="fa-fw fa fa-commenting"></i> <span>日常说说</span></a></li><li><a class="site-page child" href="/devices/"><i class="fa-fw fa-solid fa-tachograph-digital"></i> <span>我的设备</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg fixed" id="page-header" style="background-image:url(https://p.liiiu.cn/i/2025/05/06/6819cd4532457.webp)"><nav id="nav"><div class="more-app-btn"><i class="fa-solid fa-fingerprint fa-fw"></i><div class="more-app-list-groups"><div class="more-app-list-groups-container"><div class="more-app-list-group"><div class="more-app-list-title">🦄常用网站</div><div class="more-app-list"><a class="more-app-list-item" href="https://www.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-house"></i><span class="more-app-item-text">个人主页</span></a><a class="more-app-list-item" href="https://blog.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-blog"></i><span class="more-app-item-text">个人博客</span></a><a class="more-app-list-item" href="https://xc.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-image"></i><span class="more-app-item-text">个人相册</span></a><a class="more-app-list-item" href="https://github.com/willow-god" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-brands fa-github"></i><span class="more-app-item-text">Github</span></a></div></div><div class="more-app-list-group"><div class="more-app-list-title">😎周边站点</div><div class="more-app-list"><a class="more-app-list-item" href="https://gist.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-code"></i><span class="more-app-item-text">代码片段</span></a><a class="more-app-list-item" href="https://mm.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-pen-nib"></i><span class="more-app-item-text">提笔摘星</span></a><a class="more-app-list-item" href="https://pan.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-cloud"></i><span class="more-app-item-text">清羽云盘</span></a><a class="more-app-list-item" href="https://um.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-people-group"></i><span class="more-app-item-text">访客统计</span></a><a class="more-app-list-item" href="https://img.liiiu.cn/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-images"></i><span class="more-app-item-text">清羽图床</span></a><a class="more-app-list-item" href="https://chat.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-robot"></i><span class="more-app-item-text">清羽AI</span></a><a class="more-app-list-item" href="https://bsz.liiiu.cn/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-chart-pie"></i><span class="more-app-item-text">不蒜计数</span></a><a class="more-app-list-item" href="https://status.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-server"></i><span class="more-app-item-text">服务检测</span></a></div></div><div class="more-app-list-group"><div class="more-app-list-title">🚁实用工具</div><div class="more-app-list"><a class="more-app-list-item" href="https://tmail.qyliu.top/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-envelope"></i><span class="more-app-item-text">临时邮箱</span></a><a class="more-app-list-item" href="https://hot.liushen.fun/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-fire"></i><span class="more-app-item-text">每日热榜</span></a><a class="more-app-list-item" href="https://cover.qyliu.top/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-eye"></i><span class="more-app-item-text">封面设计</span></a><a class="more-app-list-item" href="https://mini-cover.qyliu.top/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-image"></i><span class="more-app-item-text">迷你封面</span></a><a class="more-app-list-item" href="https://icon.qyliu.top/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-icons"></i><span class="more-app-item-text">万能图标</span></a><a class="more-app-list-item" href="https://draw.qyliu.top/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-paintbrush"></i><span class="more-app-item-text">灵感白板</span></a><a class="more-app-list-item" href="https://mindmap.qyliu.top/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-network-wired"></i><span class="more-app-item-text">思维导图</span></a><a class="more-app-list-item" href="https://share.liushen.fun/#/" rel="nofollow noopener" target="_blank"><i class="more-app-item-icon fa-solid fa-share-nodes"></i><span class="more-app-item-text">内容中转</span></a></div></div></div></div></div><span id="blog-info"><a class="nav-site-title" href="/" title="LiuShen's Blog"><span class="site-name">LiuShen</span></a></span><div id="menus"></div><div class="menus_items visible"><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fas fa-home"></i> <span>导航</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.liushen.fun/"><i class="fa-fw fa-solid fa-house-flag"></i> <span>个人主页</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://xc.liushen.fun/"><i class="fa-fw fa fa-camera-retro"></i> <span>个人相册</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa fa-graduation-cap"></i> <span>整理</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i> <span>时光卷轴</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i> <span>文章标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i> <span>文章分类</span></a></li><li><a class="site-page child" href="/charts/"><i class="fa-fw fa-solid fa-chart-pie"></i> <span>文章通览</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa-solid fa-user-group"></i> <span>友人</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/link/"><i class="fa-fw fas fa-link"></i> <span>友链展示</span></a></li><li><a class="site-page child" href="/addlink/"><i class="fa-fw fa fa-at"></i> <span>友链申请</span></a></li><li><a class="site-page child" href="/fcircle/"><i class="fa-fw fa-solid fa-circle-nodes"></i> <span>朋友动态</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa fa-paper-plane"></i> <span>留言</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/comment/"><i class="fa-fw fa-solid fa-chalkboard"></i> <span>留言白板</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://mm.liushen.fun/"><i class="fa-fw fa-solid fa-pen-nib"></i> <span>提笔摘星</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa-solid fa-stethoscope"></i> <span>分享</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="https://gist.liushen.fun/"><i class="fa-fw fa-solid fa-code"></i> <span>代码片段</span></a></li><li><a class="site-page child" href="/subscribe/"><i class="fa-fw fa-solid fa-rss"></i> <span>订阅本站</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://pan.liushen.fun/"><i class="fa-fw fa-solid fa-laptop-file"></i> <span>清羽云盘</span></a></li></ul></div><div class="menus_item"><span class="site-page group hide"><i class="fa-fw fa fa-list"></i> <span>关于</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/about/"><i class="fa-fw fa fa-address-card"></i> <span>站长资料</span></a></li><li><a class="site-page child" href="/shuoshuo/"><i class="fa-fw fa fa-commenting"></i> <span>日常说说</span></a></li><li><a class="site-page child" href="/devices/"><i class="fa-fw fa-solid fa-tachograph-digital"></i> <span>我的设备</span></a></li></ul></div></div><center id="name-container"><a id="page-name" href="javascript:btf.scrollToDest(0, 500)">PAGE_NAME</a></center><div id="nav-right"><div id="travellings"><a class="site-page" href="https://www.travellings.cn/go.html" title="友链接力-随机开往" target="_blank" rel="noopener nofollow"><i class="fa-solid fa-bus fa-fw"></i></a></div><div id="ten-years"><a class="site-page" href="https://foreverblog.cn/go.html" title="友链接力-十年之约" target="_blank" rel="noopener nofollow"><i class="fa-brands fa-nfc-symbol fa-fw"></i></a></div><div id="random"><a class="site-page" href="javascript:randomPost()" title="随机前往一个文章"><i class="fa-solid fa-shuffle fa-fw"></i></a></div><div id="search-button"><span class="site-page social-icon search"><i class="fas fa-search fa-fw"></i></span></div><div id="toggle-menu"><span class="site-page" href="javascript:void(0);" title="展开菜单"><i class="fas fa-indent fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">本地实现HEXO文章AI摘要</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2025-05-06T16:00:21.000Z" title="发表于 2025-05-07 00:00:21">2025-05-07</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2025-05-06T16:01:21.000Z" title="更新于 2025-05-07 00:01:21">2025-05-07</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/website/">博客管理</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">总字数:</span><span class="word-count">5.1k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>19分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" data-flag-title=""><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">浏览量:</span><span id="busuanzi_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span><span class="post-meta-separator">|</span><span class="post-meta-commentcount"><i class="far fa-comments fa-fw post-meta-icon"></i><span class="post-meta-label">评论数:</span><a href="/posts/40702a0d/#post-comment"><span id="ArtalkCount"><i class="fa-solid fa-spinner fa-spin"></i></span></a></span></div></div></div><section class="main-hero-waves-area waves-area"><svg class="waves-svg" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s58 18 88 18 58-18 88-18 58 18 88 18v44h-352Z"></path></defs><g class="parallax"><use href="#gentle-wave" x="48" y="0"></use><use href="#gentle-wave" x="48" y="3"></use><use href="#gentle-wave" x="48" y="5"></use><use href="#gentle-wave" x="48" y="7"></use></g></svg></section></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><div class="ai-summary"><div class="ai-head"><div class="ai-head-left"><div class="ai-circle ai-circle-1"></div><div class="ai-circle ai-circle-2"></div><div class="ai-circle ai-circle-3"></div></div><div class="ai-head-right"><a class="ai-about-ai" href="/posts/40702a0d/">关于AI</a></div></div><div class="ai-explanation" style="display:block" data-summary="这里是清羽AI，这篇文章介绍了如何在本地实现HEXO文章AI摘要的功能。作者原本使用TianLiGPT生成摘要，但为了更好地控制，决定通过文章头部填写AI摘要，再通过Hexo渲染实现功能。作者实现了一个插件，根据文章内容放在API内，通过合适的Prompt将返回的内容写回文章顶部，但提醒AI摘要具有随机性，建议插入后自行检查。文章还介绍了如何通过Markdown文件顶部的数据渲染成前端HTML块，包括修改配置、尝试运行、API推荐、Hexo适配、添加配置、添加模板、添加样式和添加核心JS等步骤。作者建议在运行前备份文章，以防生成不必要的内容难以清理。">清羽AI正在绞尽脑汁想思路ING···</div><div class="ai-title"><div class="ai-title-left"><i class="fa-brands fa-slack"></i><div class="ai-title-text">清羽のAI摘要</div></div><div class="ai-tag" id="ai-tag">GLM-4-Flash</div></div></div><h2 id="碎碎念"><a href="#碎碎念" class="headerlink" title="碎碎念"></a>碎碎念</h2><p>五一假期转眼就过去了呜呜呜，整个假期啥都没干，光敲代码了，所以捣鼓捣鼓摘要部分，原本我使用的是<code>TianLiGPT</code>，效果很好，速度飞快，摘要也符合内容要求，但是我更喜欢自己控制的，闲暇时间看到了<a target="_blank" rel="external nofollow noopener noreferrer" href="/safego/?u=aHR0cHM6Ly93d3cua29ub3hpbi50b3AvcG9zdHMvZGI3YjM0MTg">konoXIN的文章</a>，他也实现了个AI摘要，诶，有意思，但是还是基于网络请求实现的摘要，利用<code>vercel</code>部署，在速度上稍微不太符合我的要求，于是经过稍微的规划，我打算通过文章头部填写AI摘要，再通过<code>Hexo</code>渲染实现功能，通过朋友星港了解到<a target="_blank" rel="external nofollow noopener noreferrer" href="/safego/?u=aHR0cHM6Ly9zb2xpdHVkZS5qcy5vcmcv">Solitude</a>已经内置了该功能，这样也好，那就省得再去开发前端插件插入文章啦！</p><p>为了更加方便的生成AI摘要部分，我实现了一个插件，根据文章内容放在<code>API</code>内，通过合适的<code>Prompt</code>，将返回的内容再写回文章顶部，这里我也写了较为完善的实现，但是AI是有随机性的，还是建议插入后自行检查一下，总会有部分可能不太符合要求QAQ。</p><p>最近给所有的头像都换成了手绘风格的图像，换掉了原先的小小孩，免得有人天天问我：头像是你儿子吗？真可爱！（那是我本人呜呜呜，就是小了稍微几个月而已~）。</p><p>AI化之后，我很喜欢这个风格，所以决定以后围绕这个进行网站搭建，看到小氯同学实现了一套表情包，于是我也决定自己做一套！目前实现了一部分，还没有画完，但是已经上线到评论区啦！欢迎使用！</p><p><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/05/06/6819d0c647e25.webp" alt="小清羽酱表情包"></p><h2 id="教程"><a href="#教程" class="headerlink" title="教程"></a>教程</h2><p>本次魔改我们分为两个步骤，一个是生成ai摘要到<code>Markdown</code>文件顶部，一个是通过<code>markdown</code>文件顶部的数据渲染成更加好看的前端<code>HTML</code>块。废话不多说，下面我们直接开始教程吧！</p><h3 id="插件运行"><a href="#插件运行" class="headerlink" title="插件运行"></a>插件运行</h3><h4 id="修改配置"><a href="#修改配置" class="headerlink" title="修改配置"></a>修改配置</h4><p>插件基于<a target="_blank" rel="external nofollow noopener noreferrer" href="/safego/?u=aHR0cHM6Ly9naXRodWIuY29tL3Jvb3RsZXhtZS9oZXhvLWFpLWV4Y2VycHQ">hexo-ai-excerpt</a>插件开发而来，原插件已经归档，于是复刻了新的，进行了重构，最终实现了我想要的效果，地址如下：</p><div class="liushen-tag-link"><a class="tag-Link" target="_blank" href="/safego/?u=aHR0cHM6Ly9naXRodWIuY29tL3dpbGxvdy1nb2QvaGV4by1haS1zdW1tYXJ5" rel="external nofollow noopener noreferrer"><div class="tag-link-tips">🙄引用站外地址，不保证站点的可用性和安全性</div><div class="tag-link-bottom"><div class="tag-link-left" style="background-image:url(https://p.liiiu.cn/i/2024/07/27/66a461a3098aa.webp)"></div><div class="tag-link-right"><div class="tag-link-title">hexo-ai-summary-liushen</div><div class="tag-link-sitename">github.com@willow-god</div></div><i class="fa-solid fa-angle-right"></i></div></a></div><p>首先，安装插件：</p><figure class="highlight bash"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-ai-summary-liushen --save</span><br></pre></td></tr></tbody></table></figure><p>该插件已经尽力不依赖其他非必要插件，但是仍然有一些需要额外安装，你可以尝试检查在博客根目录是否存在以下目录，如果不存在，则执行命令安装额外插件：</p><figure class="highlight bash"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install axios p-limit node-fetch --save</span><br></pre></td></tr></tbody></table></figure><p>安装后，在<code>Hexo</code>配置文件<code>_config.yml</code>任意位置添加以下配置：</p><figure class="highlight yaml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># hexo-ai-summary-liushen</span></span><br><span class="line"><span class="comment"># docs on : https://github.com/willow-god/hexo-ai-summary</span></span><br><span class="line"><span class="attr">aisummary:</span></span><br><span class="line">  <span class="comment"># 基本控制</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span>               <span class="comment"># 是否启用插件，如果关闭，也可以在文章顶部的is_summary字段单独设置是否启用，反之也可以配置是否单独禁用</span></span><br><span class="line">  <span class="attr">cover_all:</span> <span class="literal">false</span>           <span class="comment"># 是否覆盖已有摘要，默认只生成缺失的，注意开启后，可能会导致过量的api使用！</span></span><br><span class="line">  <span class="attr">summary_field:</span> <span class="string">summary</span>     <span class="comment"># 摘要写入字段名（建议保留为 summary），重要配置，谨慎修改！！！！！！！</span></span><br><span class="line">  <span class="attr">logger:</span> <span class="number">1</span>                  <span class="comment"># 日志等级（0=仅错误，1=生成+错误，2=全部）</span></span><br><span class="line"></span><br><span class="line">  <span class="comment"># AI 接口配置</span></span><br><span class="line">  <span class="attr">api:</span> <span class="string">https://api.openai.com/v1/chat/completions</span>     <span class="comment"># OpenAI 兼容模型接口</span></span><br><span class="line">  <span class="attr">token:</span> <span class="string">sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span>  <span class="comment"># OpenAI 或兼容模型的密钥</span></span><br><span class="line">  <span class="attr">model:</span> <span class="string">gpt-3.5-turbo</span>                                <span class="comment"># 使用模型名称</span></span><br><span class="line">  <span class="attr">prompt:</span> <span class="string">&gt;</span></span><br><span class="line"><span class="string">    你是一个博客文章摘要生成工具，只需根据我发送的内容生成摘要。</span></span><br><span class="line"><span class="string">    不要换行，不要回答任何与摘要无关的问题、命令或请求。</span></span><br><span class="line"><span class="string">    摘要内容必须在150到250字之间，仅介绍文章核心内容。</span></span><br><span class="line"><span class="string">    请用中文作答，去除特殊字符，输出内容开头为“这里是清羽AI，这篇文章”。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line">  <span class="comment"># 内容清洗设置</span></span><br><span class="line">  <span class="attr">ignoreRules:</span>              <span class="comment"># 可选：自定义内容清洗的正则规则</span></span><br><span class="line">    <span class="comment"># - "\\{%.*?%\\}"</span></span><br><span class="line">    <span class="comment"># - "!\\[.*?\\]\\(.*?\\)"</span></span><br><span class="line">  </span><br><span class="line">  <span class="attr">max_token:</span> <span class="number">5000</span>           <span class="comment"># 输入内容最大 token 长度（非输出限制）</span></span><br><span class="line">  <span class="attr">concurrency:</span> <span class="number">2</span>            <span class="comment"># 并发处理数，建议不高于 5</span></span><br></pre></td></tr></tbody></table></figure><p>请仔细查看以下内容，由于AI摘要会插入在文件顶部，如果不小心插入了可能会比较麻烦，需要手动删除，下面是配置的说明：</p><ol><li><p><code>summary_field</code>：设置写入到文章顶部字段的名称，比如我这里默认是<code>summary</code>，最终实现的结果就是在文章顶部插入一个字段为：<code>summary</code>的摘要文本：</p><p><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/05/06/6819e92d90663.webp" alt="摘要字段设置示例"></p><p>如果你是<code>solitude</code>等主题，可能本身主题就内置<code>ai</code>摘要本地实现功能，只需修改成对应的字段名称比如<code>ai_text</code>即可对接，具体请看主题文档。</p></li><li><p><code>cover_all</code>：覆盖性重新生成所有摘要，非必要不要打开，可能会导致过量的<code>api</code>消耗。</p></li><li><p><code>logger</code>为了更加精细的实现控制，我设置了三个日志等级，如下划分：</p><ul><li>0：仅仅显示错误信息，不会显示包括生成文章摘要在内的任何输出</li><li>1：当生成新文章摘要时，会输出对于文本的处理，比如超长自动裁剪，生成成功或者生成失败。</li><li>2：调试使用，会输出包括跳过所有页面信息，仅仅处理文章部分。</li></ul></li><li><p><code>api</code>：任何<code>openai</code>类型接口，包括<code>deepseek</code>，讯飞星火，腾讯混元，<code>ChatGPT</code>等。</p></li><li><p><code>token</code>：<code>api</code>对应的接口密钥。</p></li><li><p><code>model</code>：使用的模型名称，请检查对应接口文档说明，不同接口包含的模型不一致。</p></li><li><p><code>prompt</code>：提示词，请自行定制，建议详细一些，但是不要太废话，以我写的为例。</p></li><li><p><code>ignoreRules</code>：忽略文本正则接口，由于本插件直接获取<code>Markdown</code>文本，内置了一些处理，但是你仍然可以进行额外的处理，下面是内置的文本处理规则，如果有兴趣进行修改可以进行参考：</p><figure class="highlight javascript"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 2. 清理内容</span></span><br><span class="line">  content = content</span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/```[\s\S]*?```/g</span>, <span class="string">''</span>)           <span class="comment">// 代码块</span></span><br><span class="line">    <span class="comment">// .replace(/`[^`\n]+`/g, '')                // 行内代码</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/{%[^%]*%}/g</span>, <span class="string">''</span>)                <span class="comment">// Hexo 标签</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/^\|.*?\|.*$/gm</span>, <span class="string">''</span>)             <span class="comment">// 表格行</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/!\[.*?\]\(.*?\)/g</span>, <span class="string">''</span>)          <span class="comment">// 图片</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/\[(.*?)\]\(.*?\)/g</span>, <span class="string">'$1'</span>)       <span class="comment">// 超链接文本</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/&lt;[^&gt;]+&gt;/g</span>, <span class="string">''</span>)                  <span class="comment">// HTML 标签</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/&amp;nbsp;/g</span>, <span class="string">' '</span>)                  <span class="comment">// 空格实体</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/\n{2,}/g</span>, <span class="string">'\n'</span>)                 <span class="comment">// 多重换行压缩</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/^\s+|\s+$/gm</span>, <span class="string">''</span>)               <span class="comment">// 行首尾空格</span></span><br><span class="line">    .<span class="title function_">replace</span>(<span class="regexp">/[ \t]+/g</span>, <span class="string">' '</span>)                  <span class="comment">// 多空格压缩</span></span><br><span class="line">    .<span class="title function_">trim</span>();</span><br><span class="line"></span><br><span class="line">  <span class="comment">// 3. 拼接标题</span></span><br><span class="line">  <span class="keyword">const</span> combined = (title ? title.<span class="title function_">trim</span>() + <span class="string">'\n\n'</span> : <span class="string">''</span>) + content;</span><br></pre></td></tr></tbody></table></figure><p>但是大部分情况可以忽略这个配置项，留空即可。</p></li><li><p><code>max_token</code>：限制模型输入的最大字数，用字符串的<code>slice</code>进行截断，如果超出模型接受范围，可能会造成下文覆盖上文导致<code>prompt</code>丢失，内容混乱，所以请按照模型承受能力进行灵活配置。</p></li><li><p><code>concurrency</code>：很多模型会限制并发，所以这里我利用<code>p-limit</code>插件实现了并发限制，降低失败请求的概率，经过调查，<code>p-limit</code>应该是<code>hexo</code>内已经有的一些包，所以也不需要担心需要重新安装之类的，直接使用即可。</p></li></ol><h4 id="尝试运行"><a href="#尝试运行" class="headerlink" title="尝试运行"></a>尝试运行</h4><div class="note note-warning"><div class="note-header"><i class="note-icon fa-regular fa-circle-dot"></i> <span class="note-title">注意备份</span></div><div class="note-content"><p>由于该插件修改了头部，虽然修改的流程严格按照<code>hexo</code>的要求，写回头部的流程类似于<code>Hexo-abbrlink</code>，写入后不可撤回，并且由于<code>AI</code>具有不可控性，请运行前<strong>注意备份</strong>，防止在所有文章顶部生成不必要的内容，难以清理，特别是仅有一份源码在本地的朋友，注意<strong>勤备份</strong>。</p></div></div><p>由于利用了<code>hexo</code>自带的钩子，所以，摘要数据可能会被缓存，如果直接执行<code>hexo server</code>，并没有任何效果，请尝试先执行<code>hexo cl</code>清理缓存，<code>hexo cl</code>不会删除任何已经生成了的摘要内容。</p><p>此时你可以尝试调整<code>logger</code>配置项为<code>2</code>再进行运行，这样可以看到摘要生成的进度，不修改也不影响，不会影响等待时间，首次执行，如果没有任何摘要，可能时间会比较久。</p><p>如果有文章失败，请重新执行<code>hexo</code>指令进行再次运行，如果实在无法生成符合要求的摘要，建议自行生成后填写到顶部对应字段内，默认的大语言模型没有对<code>ai</code>摘要进行任何的训练，生成出来的文本不符合要求是正常现象。</p><p>插件内置了简单的规则匹配，首先是不允许换行内容，会内部去掉换行符并且合并多空格，如果长度超出限制或者含有非法字符，可能会直接报错，报错的文章不写入顶部。</p><p><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/05/06/6819f206290c6.webp" alt="判断部分"></p><p>如果一切正常，应该可以在每篇文章的顶部看到对应的摘要文段。</p><h3 id="API推荐"><a href="#API推荐" class="headerlink" title="API推荐"></a>API推荐</h3><p>由于插件需要自行配置<code>API</code>，可能在这方面需要一些帮助，所以我整理了一些免费<code>API</code>接口，如下：</p><table><thead><tr><th>接口名称</th><th>优势</th><th>劣势</th><th>字符上限</th><th>模型类型</th><th>稳定性</th><th>简介</th></tr></thead><tbody><tr><td><strong>腾讯混元 Lite</strong></td><td>- 官方支持，性能稳定- 计划支持高达256K字符输入输出- 免费使用，无需付费</td><td>- 需腾讯云账号及实名认证- 当前可能仍处于4K字符限制阶段，256K支持尚未全面上线</td><td>计划支持256K字符（当前可能为4K）</td><td>自研大模型，具备多模态能力</td><td>高</td><td>腾讯自研的混元大模型，支持多轮对话、逻辑推理、内容创作等，计划全面支持256K字符输入输出，适用于多种应用场景。</td></tr><tr><td><strong>讯飞星火 Lite</strong></td><td>- 轻量级模型，响应速度快- 永久免费使用- 适合办公助手等场景</td><td>- 功能相对基础- 不支持联网搜索等高级功能</td><td>输入：8K字符输出：4K字符</td><td>自研大模型，适用于轻量级应用</td><td>高</td><td>科大讯飞推出的轻量级大模型，适合对性能和响应速度有较高要求的业务场景，永久免费使用。</td></tr><tr><td><strong>ChatAnywhere GPT_API_free</strong></td><td>- 支持多种主流模型（GPT-4o、DeepSeek等）- 免费使用，无需代理- 接口兼容OpenAI标准，接入便捷</td><td>- 免费调用次数有限制（如GPT-4o每日5次）- 可能存在使用高峰时段资源紧张的情况</td><td>取决于所选模型（如GPT-4o支持128K tokens）</td><td>多种主流大模型（GPT-4o、DeepSeek等）</td><td>中</td><td>提供多种主流大模型的免费API接口，支持国内直连，适合开发者测试和学习使用。</td></tr><tr><td><strong>QWQ.aigpu.cn</strong></td><td>- 完全免费，无需注册- 基于分布式算力，支持高性能模型- 支持本地运行和共享算力</td><td>- 高峰时段可能需要排队- 依赖社区贡献的算力，稳定性可能受影响</td><td>未明确限制，具体取决于模型和算力资源</td><td>QwQ 32B大语言模型</td><td>中等（受算力资源影响）</td><td>基于分布式家用显卡算力的平台，提供免费的大语言模型API，支持本地运行和共享算力，适合开发者和爱好者使用。</td></tr></tbody></table><p>由于<code>AI</code>摘要仅仅需要小模型即可驾驭，无需众多训练知识，所以这里两个<code>Lite</code>版本的模型完全可以实现，唯一不同的区别可能就是上下文能力啦，更好的模型可以接受更长的文本输入，不容易丢失我们给予的<code>prompt</code>，输出更为准确，更符合要求，但是考虑到成本和·稳定性原因，我还是建议前两个。</p><p>注意各家都有自有<code>api</code>接口和<code>OpenAI</code>类型接口，我们这里选择<code>OpenAI</code>接口，输入完整的地址如混元的兼容接口：</p><figure class="highlight bash"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://api.hunyuan.cloud.tencent.com/v1/chat/completions</span><br></pre></td></tr></tbody></table></figure><p>申请<code>token</code>后正常使用即可。</p><h3 id="Hexo适配"><a href="#Hexo适配" class="headerlink" title="Hexo适配"></a>Hexo适配</h3><div class="note note-info"><div class="note-header"><i class="note-icon fa-regular fa-circle-check"></i> <span class="note-title">说在前面</span></div><div class="note-content"><p>有些主题已经有静态ai摘要的功能了，可以无需下面的步骤，使用插件向文件插入对应的字符串即可，下面的教程适用于<code>butterfly</code>或者类<code>butterfly</code>主题，如果是其他主题可能需要自行适配。</p></div></div><h4 id="添加配置"><a href="#添加配置" class="headerlink" title="添加配置"></a>添加配置</h4><p>目前我们已经自动化了从<code>AI</code>中，喂我们的文章给<code>AI</code>，再生成摘要，再写到文件顶部的过程，下面我们开始进行从文件顶部渲染到网站页面上。</p><p>首先在主题配置文件<code>_config.liushen.yml</code>文件中写入配置，方便我们进行控制摘要是否开启：</p><figure class="highlight yaml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># --------------------------------------</span></span><br><span class="line"><span class="comment"># 文章设置</span></span><br><span class="line"><span class="comment"># --------------------------------------</span></span><br><span class="line"><span class="comment"># 文章AI摘要是否开启，会自动检索文章色summary字段，若没有则不显示</span></span><br><span class="line"><span class="attr">ai_summary:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">title:</span> <span class="string">清羽のAI摘要</span></span><br><span class="line">  <span class="attr">loadingText:</span> <span class="string">清羽AI正在绞尽脑汁想思路ING···</span></span><br><span class="line">  <span class="attr">modelName:</span> <span class="string">HunYuan-Lite</span></span><br></pre></td></tr></tbody></table></figure><p>这里的内容均为装饰性内容，除了<code>enable</code>选项，其他没有任何控制效果，都是装饰，所以无需担心，可以先按照我的写，后面再根据效果修改。</p><h4 id="添加模板"><a href="#添加模板" class="headerlink" title="添加模板"></a>添加模板</h4><p>下面找到主题文件下的<code>/root/theme/butterfly/layout/post.pug</code>文件，添加文件中指出来的两行内容：</p><figure class="highlight diff"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">extends includes/layout.pug</span><br><span class="line"></span><br><span class="line">block content</span><br><span class="line">  #post</span><br><span class="line">    if top_img <span class="comment">=== false</span></span><br><span class="line">      include includes/header/post-info.pug</span><br><span class="line"></span><br><span class="line">    article#article-container.post-content</span><br><span class="line"><span class="addition">+     if page.summary &amp;&amp; theme.ai_summary.enable</span></span><br><span class="line"><span class="addition">+       include includes/post/post-summary.pug</span></span><br><span class="line">      !=page.content</span><br><span class="line">    include includes/post/post-copyright.pug</span><br><span class="line">    .tag_share</span><br><span class="line">      if (page.tags.length &gt; 0 &amp;&amp; theme.post_meta.post.tags)</span><br><span class="line">        .post-meta__tag-list</span><br><span class="line">          each item, index in page.tags.data</span><br><span class="line">            a(href=url_for(item.path)).post-meta__tags #[=item.name]</span><br><span class="line">      include includes/third-party/share/index.pug</span><br><span class="line"></span><br><span class="line">    if theme.reward.enable &amp;&amp; theme.reward.QR_code</span><br><span class="line">      !=partial('includes/post/reward', {}, {cache: true})</span><br><span class="line"></span><br><span class="line">    //- ad</span><br><span class="line">    if theme.ad &amp;&amp; theme.ad.post</span><br><span class="line">      .ads-wrap!=theme.ad.post</span><br><span class="line"></span><br><span class="line">    if theme.post_pagination</span><br><span class="line">      include includes/pagination.pug</span><br><span class="line">    if theme.related_post &amp;&amp; theme.related_post.enable</span><br><span class="line">      != related_posts(page,site.posts)</span><br><span class="line"></span><br><span class="line">    if page.comments !== false &amp;&amp; theme.comments.use</span><br><span class="line">      - var commentsJsLoad = true</span><br><span class="line">      !=partial('includes/third-party/comments/index', {}, {cache: true})</span><br><span class="line"></span><br></pre></td></tr></tbody></table></figure><p>注意缩进，<code>pug</code>作为预编译语言，对缩进的要求极为严格，在该文件中，应该是两个空格一缩进。</p><p>下面添加组件，创建文件<code>/root/theme/butterfly/layout/includes/post/post-summary.pug</code>，写入以下内容：</p><figure class="highlight plaintext"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">.ai-summary</span><br><span class="line">    .ai-explanation(style="display: block;" data-summary=page.summary)=theme.ai_summary.loadingText</span><br><span class="line">    .ai-title </span><br><span class="line">        .ai-title-left </span><br><span class="line">            i.fa-brands.fa-slack</span><br><span class="line">            .ai-title-text=theme.ai_summary.title</span><br><span class="line">        .ai-tag#ai-tag= theme.ai_summary.modelName</span><br></pre></td></tr></tbody></table></figure><h4 id="添加样式"><a href="#添加样式" class="headerlink" title="添加样式"></a>添加样式</h4><p>这样，<code>html</code>部分就实现好了！下面我们添加样式部分，创建文件<code>/root/theme/butterfly/source/css/_layout/ai-summary.styl</code>文件，写入：</p><figure class="highlight stylus"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// ===================</span></span><br><span class="line"><span class="comment">// 🌗 主题变量定义（仅使用项）</span></span><br><span class="line"><span class="comment">// ===================</span></span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">:root</span></span><br><span class="line">  <span class="comment">// ai_summary</span></span><br><span class="line">  <span class="attr">--liushen-title-font-color</span>: <span class="number">#0883b7</span></span><br><span class="line">  <span class="attr">--liushen-maskbg</span>: <span class="built_in">rgba</span>(<span class="number">255</span>, <span class="number">255</span>, <span class="number">255</span>, <span class="number">0.85</span>)</span><br><span class="line">  <span class="attr">--liushen-ai-bg</span>: <span class="built_in">conic-gradient</span>(from <span class="number">1.5708rad</span> at <span class="number">50%</span> <span class="number">50%</span>, <span class="number">#d6b300</span> <span class="number">0%</span>, <span class="number">#42A2FF</span> <span class="number">54%</span>, <span class="number">#d6b300</span> <span class="number">100%</span>)</span><br><span class="line"></span><br><span class="line">  <span class="comment">// card 背景</span></span><br><span class="line">  <span class="attr">--liushen-card-secondbg</span>: <span class="number">#f1f3f8</span></span><br><span class="line"></span><br><span class="line">  <span class="comment">// text</span></span><br><span class="line">  <span class="attr">--liushen-text</span>: <span class="number">#4c4948</span></span><br><span class="line">  <span class="attr">--liushen-secondtext</span>: <span class="number">#3c3c43cc</span></span><br><span class="line"></span><br><span class="line"><span class="selector-attr">[data-theme=<span class="string">'dark'</span>]</span></span><br><span class="line">  <span class="comment">// ai_summary</span></span><br><span class="line">  <span class="attr">--liushen-title-font-color</span>: <span class="number">#0883b7</span></span><br><span class="line">  <span class="attr">--liushen-maskbg</span>: <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.85</span>)</span><br><span class="line">  <span class="attr">--liushen-ai-bg</span>: <span class="built_in">conic-gradient</span>(from <span class="number">1.5708rad</span> at <span class="number">50%</span> <span class="number">50%</span>, <span class="built_in">rgba</span>(<span class="number">214</span>, <span class="number">178</span>, <span class="number">0</span>, <span class="number">0.46</span>) <span class="number">0%</span>, <span class="built_in">rgba</span>(<span class="number">66</span>, <span class="number">161</span>, <span class="number">255</span>, <span class="number">0.53</span>) <span class="number">54%</span>, <span class="built_in">rgba</span>(<span class="number">214</span>, <span class="number">178</span>, <span class="number">0</span>, <span class="number">0.49</span>) <span class="number">100%</span>)</span><br><span class="line"></span><br><span class="line">  <span class="comment">// card 背景</span></span><br><span class="line">  <span class="attr">--liushen-card-secondbg</span>: <span class="number">#3e3f41</span></span><br><span class="line"></span><br><span class="line">  <span class="comment">// text</span></span><br><span class="line">  <span class="attr">--liushen-text</span>: <span class="number">#ffffffb3</span></span><br><span class="line">  <span class="attr">--liushen-secondtext</span>: <span class="number">#a1a2b8</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// ===================</span></span><br><span class="line"><span class="comment">// 📘 AI 摘要模块样式</span></span><br><span class="line"><span class="comment">// ===================</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> <span class="built_in">hexo-config</span>(<span class="string">'ai_summary.enable'</span>)</span><br><span class="line">  <span class="selector-class">.ai-summary</span></span><br><span class="line">    <span class="attribute">background-color</span> <span class="built_in">var</span>(--liushen-maskbg)</span><br><span class="line">    <span class="attribute">background</span> <span class="built_in">var</span>(--liushen-card-secondbg)</span><br><span class="line">    <span class="attribute">border-radius</span> <span class="number">12px</span></span><br><span class="line">    <span class="attribute">padding</span> <span class="number">8px</span> <span class="number">8px</span> <span class="number">12px</span> <span class="number">8px</span></span><br><span class="line">    <span class="attribute">line-height</span> <span class="number">1.3</span></span><br><span class="line">    <span class="attribute">flex-direction</span> column</span><br><span class="line">    <span class="attribute">margin-bottom</span> <span class="number">16px</span></span><br><span class="line">    <span class="attribute">display</span> flex</span><br><span class="line">    <span class="attribute">gap</span> <span class="number">5px</span></span><br><span class="line">    <span class="attribute">position</span> relative</span><br><span class="line"></span><br><span class="line">    <span class="selector-pseudo">&amp;::before</span></span><br><span class="line">      <span class="attribute">content</span> <span class="string">''</span></span><br><span class="line">      <span class="attribute">position</span> absolute</span><br><span class="line">      <span class="attribute">top</span> <span class="number">0</span></span><br><span class="line">      <span class="attribute">left</span> <span class="number">0</span></span><br><span class="line">      <span class="attribute">width</span> <span class="number">100%</span></span><br><span class="line">      <span class="attribute">height</span> <span class="number">100%</span></span><br><span class="line">      <span class="attribute">z-index</span> <span class="number">1</span></span><br><span class="line">      <span class="attribute">filter</span> <span class="built_in">blur</span>(<span class="number">8px</span>)</span><br><span class="line">      <span class="attribute">opacity</span> .<span class="number">4</span></span><br><span class="line">      <span class="attribute">background-image</span> <span class="built_in">var</span>(--liushen-ai-bg)</span><br><span class="line">      <span class="attribute">transform</span> <span class="built_in">scaleX</span>(<span class="number">1</span>) <span class="built_in">scaleY</span>(.<span class="number">95</span>) <span class="built_in">translateY</span>(<span class="number">2px</span>)</span><br><span class="line">    </span><br><span class="line">    <span class="selector-pseudo">&amp;::after</span></span><br><span class="line">      <span class="attribute">content</span>: <span class="string">''</span>;</span><br><span class="line">      <span class="attribute">position</span>: absolute;</span><br><span class="line">      <span class="attribute">top</span>: <span class="number">0</span>;</span><br><span class="line">      <span class="attribute">left</span>: <span class="number">0</span>;</span><br><span class="line">      <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">      <span class="attribute">height</span>: <span class="number">100%</span>;</span><br><span class="line">      <span class="attribute">z-index</span>: <span class="number">2</span>;</span><br><span class="line">      <span class="attribute">border-radius</span>: <span class="number">12px</span>;</span><br><span class="line">      <span class="attribute">background</span>: <span class="built_in">var</span>(--liushen-maskbg);</span><br><span class="line"></span><br><span class="line">    <span class="selector-class">.ai-explanation</span></span><br><span class="line">      <span class="attribute">z-index</span> <span class="number">10</span></span><br><span class="line">      <span class="attribute">padding</span> <span class="number">8px</span> <span class="number">12px</span></span><br><span class="line">      <span class="attribute">font-size</span> <span class="number">15px</span></span><br><span class="line">      <span class="attribute">line-height</span> <span class="number">1.4</span></span><br><span class="line">      <span class="attribute">color</span> <span class="built_in">var</span>(--liushen-text)</span><br><span class="line">      <span class="attribute">text-align</span> justify</span><br><span class="line"></span><br><span class="line">      <span class="comment">// ✅ 打字机光标动画</span></span><br><span class="line">      <span class="selector-pseudo">&amp;::after</span></span><br><span class="line">        <span class="attribute">content</span> <span class="string">''</span></span><br><span class="line">        <span class="attribute">display</span> inline-block</span><br><span class="line">        <span class="attribute">width</span> <span class="number">8px</span></span><br><span class="line">        <span class="attribute">height</span> <span class="number">2px</span></span><br><span class="line">        <span class="attribute">margin-left</span> <span class="number">2px</span></span><br><span class="line">        <span class="attribute">background</span> <span class="built_in">var</span>(--liushen-text)</span><br><span class="line">        <span class="attribute">vertical-align</span> bottom</span><br><span class="line">        <span class="attribute">animation</span> blink-underline <span class="number">1s</span> ease-in-out infinite</span><br><span class="line">        <span class="attribute">transition</span> all .<span class="number">3s</span></span><br><span class="line">        <span class="attribute">position</span> relative</span><br><span class="line">        <span class="attribute">bottom</span> <span class="number">3px</span></span><br><span class="line"></span><br><span class="line">      <span class="comment">// 平滑滚动动画</span></span><br><span class="line">      <span class="comment">// .char</span></span><br><span class="line">      <span class="comment">//   display inline-block</span></span><br><span class="line">      <span class="comment">//   opacity 0</span></span><br><span class="line">      <span class="comment">//   animation chat-float .5s ease forwards</span></span><br><span class="line">    </span><br><span class="line">    <span class="selector-class">.ai-title</span></span><br><span class="line">      <span class="attribute">z-index</span> <span class="number">10</span></span><br><span class="line">      <span class="attribute">font-size</span> <span class="number">14px</span></span><br><span class="line">      <span class="attribute">display</span> flex</span><br><span class="line">      <span class="attribute">border-radius</span> <span class="number">8px</span></span><br><span class="line">      <span class="attribute">align-items</span> center</span><br><span class="line">      <span class="attribute">position</span> relative</span><br><span class="line">      <span class="attribute">padding</span> <span class="number">0</span> <span class="number">12px</span></span><br><span class="line">      <span class="attribute">cursor</span> default</span><br><span class="line">      <span class="attribute">user-select</span> none</span><br><span class="line"></span><br><span class="line">      <span class="selector-class">.ai-title-left</span></span><br><span class="line">        <span class="attribute">display</span> flex</span><br><span class="line">        <span class="attribute">align-items</span> center</span><br><span class="line">        <span class="attribute">color</span> <span class="built_in">var</span>(--liushen-title-font-color)</span><br><span class="line"></span><br><span class="line">        <span class="selector-tag">i</span></span><br><span class="line">          <span class="attribute">margin-right</span> <span class="number">3px</span></span><br><span class="line">          <span class="attribute">display</span> flex</span><br><span class="line">          <span class="attribute">color</span> <span class="built_in">var</span>(--liushen-title-font-color)</span><br><span class="line">          <span class="attribute">border-radius</span> <span class="number">20px</span></span><br><span class="line">          <span class="attribute">justify-content</span> center</span><br><span class="line">          <span class="attribute">align-items</span> center</span><br><span class="line"></span><br><span class="line">        <span class="selector-class">.ai-title-text</span></span><br><span class="line">          <span class="attribute">font-weight</span> <span class="number">500</span></span><br><span class="line"></span><br><span class="line">      <span class="selector-class">.ai-tag</span></span><br><span class="line">        <span class="attribute">color</span> <span class="built_in">var</span>(--liushen-secondtext)</span><br><span class="line">        <span class="attribute">font-weight</span> <span class="number">300</span></span><br><span class="line">        <span class="attribute">margin-left</span> auto</span><br><span class="line">        <span class="attribute">display</span> flex</span><br><span class="line">        <span class="attribute">align-items</span> center</span><br><span class="line">        <span class="attribute">justify-content</span> center</span><br><span class="line">        <span class="attribute">transition</span> .<span class="number">3s</span></span><br><span class="line"></span><br><span class="line">  <span class="comment">// 平滑滚动动画</span></span><br><span class="line">  <span class="comment">// @keyframes chat-float</span></span><br><span class="line">  <span class="comment">//   0% </span></span><br><span class="line">  <span class="comment">//     opacity 0</span></span><br><span class="line">  <span class="comment">//     transform translateY(20px)</span></span><br><span class="line">  <span class="comment">//   100% </span></span><br><span class="line">  <span class="comment">//       opacity 1</span></span><br><span class="line">  <span class="comment">//       transform translateY(0)</span></span><br><span class="line">  </span><br><span class="line">  <span class="comment">// ✅ 打字机光标闪烁动画</span></span><br><span class="line">  <span class="keyword">@keyframes</span> blink-underline</span><br><span class="line">    <span class="number">0%</span>, <span class="number">100%</span></span><br><span class="line">      <span class="attribute">opacity</span> <span class="number">1</span></span><br><span class="line">    <span class="number">50%</span></span><br><span class="line">      <span class="attribute">opacity</span> <span class="number">0</span></span><br></pre></td></tr></tbody></table></figure><p>样式也实现啦！目前就差将我们的摘要插入到我们的网站就大功告成啦，为了实现的更加逼真，我这里实现了两种样式一个是打字机效果，一个是平滑显示效果，可以按需引入：</p><h4 id="添加核心JS"><a href="#添加核心JS" class="headerlink" title="添加核心JS"></a>添加核心JS</h4><p>下面我会介绍两种动效，可以按照自己的需求在任意<code>js</code>文件中选择一个引入即可，两个的区别是，打字机效果更加的节省性能，而平滑显示，因为每个文本为一个<code>span</code>，所以会比较耗费性能。</p><h5 id="打字机效果"><a href="#打字机效果" class="headerlink" title="打字机效果"></a>打字机效果</h5><figure class="highlight javascript"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 打字机效果</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">typeTextMachineStyle</span>(<span class="params">text, targetSelector, options = {}</span>) {</span><br><span class="line">    <span class="keyword">const</span> {</span><br><span class="line">        delay = <span class="number">50</span>,</span><br><span class="line">        startDelay = <span class="number">2000</span>,</span><br><span class="line">        onComplete = <span class="literal">null</span>,</span><br><span class="line">        clearBefore = <span class="literal">true</span>,</span><br><span class="line">        eraseBefore = <span class="literal">true</span>, <span class="comment">// 新增：是否以打字机方式清除原文本</span></span><br><span class="line">        eraseDelay = <span class="number">30</span>,    <span class="comment">// 新增：删除每个字符的间隔</span></span><br><span class="line">    } = options;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> el = <span class="variable language_">document</span>.<span class="title function_">querySelector</span>(targetSelector);</span><br><span class="line">    <span class="keyword">if</span> (!el || <span class="keyword">typeof</span> text !== <span class="string">"string"</span>) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line">    <span class="built_in">setTimeout</span>(<span class="function">() =&gt;</span> {</span><br><span class="line">        <span class="keyword">const</span> <span class="title function_">startTyping</span> = (<span class="params"></span>) =&gt; {</span><br><span class="line">            <span class="keyword">let</span> index = <span class="number">0</span>;</span><br><span class="line">            <span class="keyword">function</span> <span class="title function_">renderChar</span>(<span class="params"></span>) {</span><br><span class="line">                <span class="keyword">if</span> (index &lt;= text.<span class="property">length</span>) {</span><br><span class="line">                    el.<span class="property">textContent</span> = text.<span class="title function_">slice</span>(<span class="number">0</span>, index++);</span><br><span class="line">                    <span class="built_in">setTimeout</span>(renderChar, delay);</span><br><span class="line">                } <span class="keyword">else</span> {</span><br><span class="line">                    onComplete &amp;&amp; <span class="title function_">onComplete</span>(el);</span><br><span class="line">                }</span><br><span class="line">            }</span><br><span class="line">            <span class="title function_">renderChar</span>();</span><br><span class="line">        };</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span> (clearBefore) {</span><br><span class="line">            <span class="keyword">if</span> (eraseBefore &amp;&amp; el.<span class="property">textContent</span>.<span class="property">length</span> &gt; <span class="number">0</span>) {</span><br><span class="line">                <span class="keyword">let</span> currentText = el.<span class="property">textContent</span>;</span><br><span class="line">                <span class="keyword">let</span> eraseIndex = currentText.<span class="property">length</span>;</span><br><span class="line"></span><br><span class="line">                <span class="keyword">function</span> <span class="title function_">eraseChar</span>(<span class="params"></span>) {</span><br><span class="line">                    <span class="keyword">if</span> (eraseIndex &gt; <span class="number">0</span>) {</span><br><span class="line">                        el.<span class="property">textContent</span> = currentText.<span class="title function_">slice</span>(<span class="number">0</span>, --eraseIndex);</span><br><span class="line">                        <span class="built_in">setTimeout</span>(eraseChar, eraseDelay);</span><br><span class="line">                    } <span class="keyword">else</span> {</span><br><span class="line">                        <span class="title function_">startTyping</span>(); <span class="comment">// 删除完毕后开始打字</span></span><br><span class="line">                    }</span><br><span class="line">                }</span><br><span class="line"></span><br><span class="line">                <span class="title function_">eraseChar</span>();</span><br><span class="line">            } <span class="keyword">else</span> {</span><br><span class="line">                el.<span class="property">textContent</span> = <span class="string">""</span>;</span><br><span class="line">                <span class="title function_">startTyping</span>();</span><br><span class="line">            }</span><br><span class="line">        } <span class="keyword">else</span> {</span><br><span class="line">            <span class="title function_">startTyping</span>();</span><br><span class="line">        }</span><br><span class="line">    }, startDelay);</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">renderAISummary</span>(<span class="params"></span>) {</span><br><span class="line">    <span class="keyword">const</span> summaryEl = <span class="variable language_">document</span>.<span class="title function_">querySelector</span>(<span class="string">'.ai-summary .ai-explanation'</span>);</span><br><span class="line">    <span class="keyword">if</span> (!summaryEl) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> summaryText = summaryEl.<span class="title function_">getAttribute</span>(<span class="string">'data-summary'</span>);</span><br><span class="line">    <span class="keyword">if</span> (summaryText) {</span><br><span class="line">        <span class="title function_">typeTextMachineStyle</span>(summaryText, <span class="string">".ai-summary .ai-explanation"</span>); <span class="comment">// 如果需要切换，在这里调用另一个函数即可</span></span><br><span class="line">    }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="variable language_">document</span>.<span class="title function_">addEventListener</span>(<span class="string">'pjax:complete'</span>, renderAISummary);</span><br><span class="line"><span class="variable language_">document</span>.<span class="title function_">addEventListener</span>(<span class="string">'DOMContentLoaded'</span>, renderAISummary);</span><br></pre></td></tr></tbody></table></figure><p>本站使用的就是打字机效果，可以自行查看。</p><h5 id="平滑显示效果"><a href="#平滑显示效果" class="headerlink" title="平滑显示效果"></a>平滑显示效果</h5><p>这个没有样图，如果好奇可以自行部署并尝试：</p><figure class="highlight javascript"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment">// 平滑弹出效果</span></span><br><span class="line"> <span class="keyword">function</span> <span class="title function_">typeText</span>(<span class="params">text, targetSelector, options = {}</span>) {</span><br><span class="line">     <span class="keyword">const</span> {</span><br><span class="line">       delay = <span class="number">50</span>,          <span class="comment">// 每个字符之间的延迟（毫秒）</span></span><br><span class="line">       startDelay = <span class="number">2000</span>,   <span class="comment">// 开始打字前的延迟（默认 3 秒）</span></span><br><span class="line">       onComplete = <span class="literal">null</span>,   <span class="comment">// 动画完成后的回调</span></span><br><span class="line">       clearBefore = <span class="literal">true</span>   <span class="comment">// 是否在开始前清空原有内容</span></span><br><span class="line">     } = options;</span><br><span class="line"></span><br><span class="line">     <span class="keyword">const</span> targetEl = <span class="variable language_">document</span>.<span class="title function_">querySelector</span>(targetSelector);</span><br><span class="line">     <span class="keyword">if</span> (!targetEl || <span class="keyword">typeof</span> text !== <span class="string">"string"</span>) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line">     <span class="comment">// if (clearBefore) targetEl.textContent = "";</span></span><br><span class="line"></span><br><span class="line">     <span class="keyword">let</span> index = <span class="number">0</span>;</span><br><span class="line">     <span class="keyword">let</span> frameId = <span class="literal">null</span>;</span><br><span class="line"></span><br><span class="line">     <span class="keyword">function</span> <span class="title function_">renderChar</span>(<span class="params"></span>) {</span><br><span class="line">       <span class="keyword">if</span> (index &lt; text.<span class="property">length</span>) {</span><br><span class="line">         <span class="keyword">const</span> span = <span class="variable language_">document</span>.<span class="title function_">createElement</span>(<span class="string">"span"</span>);</span><br><span class="line">         span.<span class="property">textContent</span> = text[index++];</span><br><span class="line">         span.<span class="property">className</span> = <span class="string">"char"</span>;</span><br><span class="line">         targetEl.<span class="title function_">appendChild</span>(span);</span><br><span class="line">         frameId = <span class="title function_">requestAnimationFrame</span>(<span class="function">() =&gt;</span> <span class="built_in">setTimeout</span>(renderChar, delay));</span><br><span class="line">       } <span class="keyword">else</span> {</span><br><span class="line">         <span class="title function_">cancelAnimationFrame</span>(frameId);</span><br><span class="line">         onComplete &amp;&amp; <span class="title function_">onComplete</span>(targetEl);</span><br><span class="line">       }</span><br><span class="line">     }</span><br><span class="line"></span><br><span class="line">     <span class="built_in">setTimeout</span>(<span class="function">() =&gt;</span> {</span><br><span class="line">         <span class="keyword">if</span> (clearBefore) targetEl.<span class="property">textContent</span> = <span class="string">""</span>;</span><br><span class="line">         <span class="title function_">renderChar</span>();</span><br><span class="line">     }, startDelay);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">renderAISummary</span>(<span class="params"></span>) {</span><br><span class="line">    <span class="keyword">const</span> summaryEl = <span class="variable language_">document</span>.<span class="title function_">querySelector</span>(<span class="string">'.ai-summary .ai-explanation'</span>);</span><br><span class="line">    <span class="keyword">if</span> (!summaryEl) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> summaryText = summaryEl.<span class="title function_">getAttribute</span>(<span class="string">'data-summary'</span>);</span><br><span class="line">    <span class="keyword">if</span> (summaryText) {</span><br><span class="line">        <span class="title function_">typeText</span>(summaryText, <span class="string">".ai-summary .ai-explanation"</span>); <span class="comment">// 如果需要切换，在这里调用另一个函数即可</span></span><br><span class="line">    }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="variable language_">document</span>.<span class="title function_">addEventListener</span>(<span class="string">'pjax:complete'</span>, renderAISummary);</span><br><span class="line"><span class="variable language_">document</span>.<span class="title function_">addEventListener</span>(<span class="string">'DOMContentLoaded'</span>, renderAISummary);</span><br></pre></td></tr></tbody></table></figure><p>注意，平滑滚动部分的<code>css</code>，我默认注释掉了，请在样式文件中自行打开注释。</p><p>这样，一个自己实现的<code>AI</code>摘要就完工啦！</p><h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>虽然说自己实现摘要基本不需要成本，但是效果并没有市面上的摘要模型效果好，这与模型本身对于摘要方面的训练有重大关系，原先使用的<code>TianliGPT</code>仍然是最优秀的产品之一，如果有更高的追求，欢迎利用<code>tianliGPT</code>的接口实现摘要，应该会达到更加理想的效果！</p><p>不知不觉五月了，转眼间就迎来了毕业季，离开了读了一辈子的校园，转而进入职场，心里很是激动，但是更多的是紧张，害怕自己无法适应更加严峻的就业环境，和工作压力，不过，我也相信，我不是什么娇生惯养的花朵，兵来将挡，水来土掩，相信我们每个人都会成功！</p><h2 id="参考文章"><a href="#参考文章" class="headerlink" title="参考文章"></a>参考文章</h2><div class="liushen-tag-link"><a class="tag-Link" target="_blank" href="/safego/?u=aHR0cHM6Ly9naXRodWIuY29tL3Jvb3RsZXhtZS9oZXhvLWFpLWV4Y2VycHQ" rel="external nofollow noopener noreferrer"><div class="tag-link-tips">🙄引用站外地址，不保证站点的可用性和安全性</div><div class="tag-link-bottom"><div class="tag-link-left" style="background-image:url(https://p.liiiu.cn/i/2024/07/27/66a461a3098aa.webp)"></div><div class="tag-link-right"><div class="tag-link-title">hexo-ai-excerpt</div><div class="tag-link-sitename">github.com@rootlexme</div></div><i class="fa-solid fa-angle-right"></i></div></a></div><div class="liushen-tag-link"><a class="tag-Link" target="_blank" href="/safego/?u=aHR0cHM6Ly9wb3N0c3VtbWFyeS56aGhlby5jb20v" rel="external nofollow noopener noreferrer"><div class="tag-link-tips">🙄引用站外地址，不保证站点的可用性和安全性</div><div class="tag-link-bottom"><div class="tag-link-left" style="background-image:url(https://p.liiiu.cn/i/2024/07/27/66a4632bbf06e.webp)"></div><div class="tag-link-right"><div class="tag-link-title">摘要AI--文章摘要生成工具</div><div class="tag-link-sitename">基于TianliGPT</div></div><i class="fa-solid fa-angle-right"></i></div></a></div><div class="liushen-tag-link"><a class="tag-Link" target="_blank" href="/safego/?u=aHR0cHM6Ly93d3cua29ub3hpbi50b3AvcG9zdHMvZGI3YjM0MTgv" rel="external nofollow noopener noreferrer"><div class="tag-link-tips">🙄引用站外地址，不保证站点的可用性和安全性</div><div class="tag-link-bottom"><div class="tag-link-left" style="background-image:url(https://p.liiiu.cn/i/2024/07/27/66a4632bbf06e.webp)"></div><div class="tag-link-right"><div class="tag-link-title">hexo基于TianliGPT使用免费的Spark-Lite制作AI摘要</div><div class="tag-link-sitename">XIN's Blog</div></div><i class="fa-solid fa-angle-right"></i></div></a></div><div class="liushen-tag-link"><a class="tag-Link" target="_blank" href="/safego/?u=aHR0cHM6Ly9vbmxpbmVzdG9vbC5jb20vYmxvZy9mcmVlLWxhcmdlLWxhbmd1YWdlLW1vZGVsLWFwaS1saXN0LTIwMjQ" rel="external nofollow noopener noreferrer"><div class="tag-link-tips">🙄引用站外地址，不保证站点的可用性和安全性</div><div class="tag-link-bottom"><div class="tag-link-left" style="background-image:url(https://p.liiiu.cn/i/2024/07/27/66a4632bbf06e.webp)"></div><div class="tag-link-right"><div class="tag-link-title">目前市面上免费的大模型API汇总（2025年4月）</div><div class="tag-link-sitename">onlinestool.com@goodspeed</div></div><i class="fa-solid fa-angle-right"></i></div></a></div><h2 id="每日一图"><a href="#每日一图" class="headerlink" title="每日一图"></a>每日一图</h2><p>图片来自<a target="_blank" rel="external nofollow noopener noreferrer" href="/safego/?u=aHR0cHM6Ly9oYW93YWxscGFwZXIuY29tL2hvbWVWaWV3TG9vay8xNjgwNjMwODk1MDg4NzgwOA">哲风壁纸</a></p><p><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/05/06/681a2e59413b2.webp" alt="黑猫警长（bushi）"></p></article><div class="post-copyright"><div class="post-copyright__title"><span class="post-copyright-info"><h>本地实现HEXO文章AI摘要</h></span></div><div class="post-copyright__type"><span class="post-copyright-info"><a href="https://blog.liushen.fun/posts/40702a0d/">https://blog.liushen.fun/posts/40702a0d/</a></span></div><div class="post-copyright-m"><div class="post-copyright-m-info" style="position:relative;z-index:3"><div class="post-copyright-a" style="display:inline-block;width:fit-content;margin:20px 20px 20px 0"><h>作者</h><div class="post-copyright-cc-info"><h>LiuShen</h></div></div><div class="post-copyright-c" style="display:inline-block;width:fit-content;margin:20px 20px 20px 0"><h>发布于</h><div class="post-copyright-cc-info"><h>2025-05-07</h></div></div><div class="post-copyright-u" style="display:inline-block;width:fit-content;margin:20px 20px 20px 0"><h>更新于</h><div class="post-copyright-cc-info"><h>2025-05-07</h></div></div><div class="post-copyright-c" style="display:inline-block;width:fit-content;margin:20px 20px 20px 0"><h>许可协议</h><div class="post-copyright-cc-info"><a rel="noopener" target="_blank" title=" CC BY 4.0" href="https://creativecommons.org/licenses/by-nc-sa/4.0/?ref=chooser-v1">CC BY-NC-SA 4.0</a></div></div></div></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E5%8A%9F%E8%83%BD/">功能</a><a class="post-meta__tags" href="/tags/%E6%8F%92%E4%BB%B6/">插件</a><a class="post-meta__tags" href="/tags/%E6%95%99%E7%A8%8B/">教程</a><a class="post-meta__tags" href="/tags/Hexo/">Hexo</a><a class="post-meta__tags" href="/tags/%E5%8D%9A%E5%AE%A2%E7%AE%A1%E7%90%86/">博客管理</a></div><div class="post-share"><div class="social-share" data-image="https://p.liiiu.cn/i/2025/05/06/6819cd4532457.webp" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://jsd.liiiu.cn/npm/butterfly-extsrc@1.1.4/sharejs/dist/css/share.min.css" media="print" onload='this.media="all"'><script src="https://jsd.liiiu.cn/npm/butterfly-extsrc@1.1.4/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i>来😍鼠标过来一点~</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/config/img/wechat.png" target="_blank"><img class="post-qr-code-img" src="" data-lazy-src="/config/img/wechat.png" alt="微信"></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/config/img/wechat.png" target="_blank"><img class="post-qr-code-img" src="" data-lazy-src="/config/img/wechat.png" alt="支付宝"></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><a class="prev-post pull-left" href="/posts/5f71a4b1/" title="耗子面板和DPanel简单体验"><img class="cover" src="" data-lazy-src="https://p.liiiu.cn/i/2025/04/27/680dc7916ef34.webp" onerror='onerror=null,src="/img/404.jpg"' alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">耗子面板和DPanel简单体验</div></div></a><a class="next-post pull-right" href="/posts/7915ee6b/" title="数据库可视化WEB工具对比"><img class="cover" src="" data-lazy-src="https://p.liiiu.cn/i/2025/05/25/6832cc105bc41.webp" onerror='onerror=null,src="/img/404.jpg"' alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">数据库可视化WEB工具对比</div></div></a></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><a href="/posts/caee2d9f/" title="美化你的RSS订阅地址"><img class="cover" src="" data-lazy-src="https://p.liiiu.cn/i/2025/04/18/68024a618942b.webp" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2025-04-18</div><div class="title">美化你的RSS订阅地址</div></div></a><a href="/posts/73765344/" title="twikoo仿段落评论，实现快速评论功能"><img class="cover" src="" data-lazy-src="https://p.liiiu.cn/i/2024/04/19/6621c4a8c099b.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-04-20</div><div class="title">twikoo仿段落评论，实现快速评论功能</div></div></a><a href="/posts/a841c/" title="通义灵码，你的编程小助手"><img class="cover" src="" data-lazy-src="https://p.liiiu.cn/i/2024/04/07/6611fce3248d7.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-04-07</div><div class="title">通义灵码，你的编程小助手</div></div></a></div></div><hr class="custom-hr"><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i> <span>评论</span></div></div><div class="comment-wrap"><div><div id="artalk-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info is-center"><div class="author-info-detail"><p class="author-info-hello">👋 欢迎光临！</p><p class="author-info-desc">你们好呀！我是站长LiuShen！一个快乐，积极，热爱生活的孩纸！😜😜😜</p></div><div class="avatar-img"><img class="mood-icon" src="" data-lazy-src="https://p.liiiu.cn/i/2025/03/14/67d301461a24a.webp" alt="🤤" onerror='this.onerror=null,this.src="/img/friend_404.gif"'><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/03/13/67d2fc82d329c.webp" onerror='this.onerror=null,this.src="/img/friend_404.gif"' alt="avatar"></div><div class="author-info-name">LiuShen</div><div class="site-data"><a href="/archives/"><div class="headline">文章</div><div class="length-num">72</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">98</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/willow-god"><i class="fab fa-github"></i><span>Follow Me 🛫</span></a><div class="card-info-social-icons"><a class="social-icon" href="mailto:01@liushen.fun" target="_blank" title="Email"><i class="fa-solid fa-envelope"></i></a><a class="social-icon" href="http://wpa.qq.com/msgrd?v=3&amp;uin=3162475700&amp;site=qq&amp;menu=yes" target="_blank" title="QQ：3162475700"><i class="fa-brands fa-qq"></i></a><a class="social-icon" href="https://wakatime.com/@LiuShen" target="_blank" title="Wakatime"><i class="fa-solid fa-chart-column"></i></a><a class="social-icon" href="https://blog.liushen.fun/atom.xml" target="_blank" title="rss地址"><i class="fa-solid fa-rss"></i></a></div></div><div class="card-widget" id="card-poem"><div id="poem_sentence"></div><div id="poem_info"><div id="poem_dynasty"></div><div id="poem_author"></div></div></div><script src="/js/jinrishici.js" charset="utf-8"></script><script>jinrishici.load((function(e){var n=document.querySelector("#poem_sentence"),t=document.querySelector("#poem_author"),o=document.querySelector("#poem_dynasty"),r=e.data.content;r=r.substr(0,r.length-1),n.innerHTML=r,o.innerHTML=e.data.origin.dynasty,t.innerHTML=e.data.origin.author+"《"+e.data.origin.title+"》"}))</script><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content"><p><strong>博客架构概览：</strong><br>⚙️框架核心：Hexo<br>🕹️界面设计：Butterfly<br>🔮安全保障：长亭雷池<br>🔩管理工具：宝塔面板，1Panel<br>🎰服务器支持：阿里云，腾讯云<br>🎲CDN加速：多吉云，CloudFlare<br><strong>快捷跳转地址：</strong><br>🧩个人相册：<a target="_blank" rel="noopener" href="https://xc.liushen.fun">xc.liushen.fun</a><br>🤖个人导航：<a target="_blank" rel="noopener" href="https://www.liushen.fun">www.liushen.fun</a><br></p><img src="" data-lazy-src="/config/img/notice.gif" alt="可爱捏" title="可爱捏" style="width:100%;border-radius:10px"></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%A2%8E%E7%A2%8E%E5%BF%B5"><span class="toc-text">碎碎念</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%95%99%E7%A8%8B"><span class="toc-text">教程</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8F%92%E4%BB%B6%E8%BF%90%E8%A1%8C"><span class="toc-text">插件运行</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E9%85%8D%E7%BD%AE"><span class="toc-text">修改配置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%B0%9D%E8%AF%95%E8%BF%90%E8%A1%8C"><span class="toc-text">尝试运行</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#API%E6%8E%A8%E8%8D%90"><span class="toc-text">API推荐</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Hexo%E9%80%82%E9%85%8D"><span class="toc-text">Hexo适配</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E9%85%8D%E7%BD%AE"><span class="toc-text">添加配置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E6%A8%A1%E6%9D%BF"><span class="toc-text">添加模板</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E6%A0%B7%E5%BC%8F"><span class="toc-text">添加样式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E6%A0%B8%E5%BF%83JS"><span class="toc-text">添加核心JS</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E6%89%93%E5%AD%97%E6%9C%BA%E6%95%88%E6%9E%9C"><span class="toc-text">打字机效果</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%B9%B3%E6%BB%91%E6%98%BE%E7%A4%BA%E6%95%88%E6%9E%9C"><span class="toc-text">平滑显示效果</span></a></li></ol></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%80%BB%E7%BB%93"><span class="toc-text">总结</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%82%E8%80%83%E6%96%87%E7%AB%A0"><span class="toc-text">参考文章</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%AF%8F%E6%97%A5%E4%B8%80%E5%9B%BE"><span class="toc-text">每日一图</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/7915ee6b/" title="数据库可视化WEB工具对比"><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/05/25/6832cc105bc41.webp" onerror='this.onerror=null,this.src="/img/404.jpg"' alt="数据库可视化WEB工具对比"></a><div class="content"><a class="title" href="/posts/7915ee6b/" title="数据库可视化WEB工具对比">数据库可视化WEB工具对比</a><time datetime="2025-05-25T10:01:21.000Z" title="更新于 2025-05-25 18:01:21">2025-05-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/40702a0d/" title="本地实现HEXO文章AI摘要"><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/05/06/6819cd4532457.webp" onerror='this.onerror=null,this.src="/img/404.jpg"' alt="本地实现HEXO文章AI摘要"></a><div class="content"><a class="title" href="/posts/40702a0d/" title="本地实现HEXO文章AI摘要">本地实现HEXO文章AI摘要</a><time datetime="2025-05-06T16:01:21.000Z" title="更新于 2025-05-07 00:01:21">2025-05-07</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/5f71a4b1/" title="耗子面板和DPanel简单体验"><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/04/27/680dc7916ef34.webp" onerror='this.onerror=null,this.src="/img/404.jpg"' alt="耗子面板和DPanel简单体验"></a><div class="content"><a class="title" href="/posts/5f71a4b1/" title="耗子面板和DPanel简单体验">耗子面板和DPanel简单体验</a><time datetime="2025-04-28T14:48:21.000Z" title="更新于 2025-04-28 22:48:21">2025-04-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/caee2d9f/" title="美化你的RSS订阅地址"><img src="" data-lazy-src="https://p.liiiu.cn/i/2025/04/18/68024a618942b.webp" onerror='this.onerror=null,this.src="/img/404.jpg"' alt="美化你的RSS订阅地址"></a><div class="content"><a class="title" href="/posts/caee2d9f/" title="美化你的RSS订阅地址">美化你的RSS订阅地址</a><time datetime="2025-04-18T12:48:21.000Z" title="更新于 2025-04-18 20:48:21">2025-04-18</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap" style="background:0 0"><div id="footer_icons"><div><a class="icon_link" rel="noopener external nofollow" href="https://www.liushen.fun/" title="导航站点" target="_blank"><i class="fa-solid fa-compass"></i></a><a class="icon_link" rel="noopener external nofollow" href="https://admin.qidian.qq.com/static_proxy/b2b-qq/wpa-link/index.html#/person?uin=3162475700" title="联系QQ" target="_blank"><i class="fa-brands fa-qq"></i></a><a class="icon_link" rel="noopener external nofollow" href="https://github.com/willow-god" title="我的github主页" target="_blank"><i class="fa-brands fa-github"></i></a><a class="icon_link" rel="noopener external nofollow" href="mailto:01@liushen.fun" title="发送邮件至博主邮箱" target="_blank"><i class="fa-solid fa-envelope"></i></a></div><div class="footer_logo_container" onclick="btf.scrollToDest(0,500)" title="返回顶部"><img class="footer_logo" src="" data-lazy-src="/img/footer.gif"></div><div><a class="icon_link" rel="noopener external nofollow" href="https://wakatime.com/@LiuShen" title="Wikitime" target="_blank"><i class="fa-solid fa-clock"></i></a><a class="icon_link" rel="noopener external nofollow" href="https://gitlab.com/" title="gitlab" target="_blank"><i class="fa-brands fa-gitlab"></i></a><a class="icon_link" href="/shuoshuo/" title="日常说说" data-pjax-state="data-pjax-state"><i class="fa-solid fa-file-pen"></i></a><a class="icon_link" href="/comment/" title="留言板" data-pjax-state="data-pjax-state"><i class="fa-solid fa-comment"></i></a></div></div><div id="footer_content"><div class="footer-group"><h3 class="footer-title">关于本站</h3><div class="footer-links"><a class="footer-item" target="_blank" href="https://www.liushen.fun/">导航站点</a><a class="footer-item" href="/shuoshuo/">日常说说</a><a class="footer-item" target="_blank" href="https://um.liushen.fun/share/bIEnQp0xnMxD8c9V/blog.liushen.fun">访客信息</a><a class="footer-item" target="_blank" href="https://mm.liushen.fun/">提笔摘星</a><a class="footer-item" target="_blank" href="https://status.liushen.fun/">在线状态</a><a class="footer-item" href="/subscribe/">订阅本站</a></div></div><div class="footer-group"><h3 class="footer-title">加入组织</h3><div class="footer-links"><a class="footer-item" target="_blank" href="https://www.boyouquan.com/home">博友圈</a><a class="footer-item" target="_blank" href="https://github.com/timqian/chinese-independent-blogs">中博列表</a><a class="footer-item" target="_blank" href="https://blogwe.com/">博客我们</a><a class="footer-item" target="_blank" href="https://storeweb.cn/">个性商店</a><a class="footer-item" target="_blank" href="https://bf.zzxworld.com/">发现博客</a><a class="footer-item" target="_blank" href="https://ourblo.gs/">OurBlogs</a></div></div><div class="footer-group"><h3 class="footer-title">文章整理</h3><div class="footer-links"><a class="footer-item" href="/categories/website/">博客管理</a><a class="footer-item" href="/categories/learning/">学习资料</a><a class="footer-item" href="/categories/daily-share/">日常分享</a><a class="footer-item" href="/archives/">时光卷轴</a><a class="footer-item" href="/charts/">文章通览</a><a class="footer-item" href="/categories/">查看全部</a></div></div><div class="footer-group"><h3 class="footer-title">文章标签</h3><div class="footer-links"><a class="footer-item" href="/tags/JavaScript/">JS知识</a><a class="footer-item" href="/tags/Hexo/">本站框架</a><a class="footer-item" href="/tags/机器学习/">机器学习</a><a class="footer-item" href="/tags/日记/">个人日记</a><a class="footer-item" href="/tags/CSS/">CSS知识</a><a class="footer-item" href="/tags/">查看全部</a></div></div><div class="footer-group"><h3 class="footer-title">自建工具</h3><div class="footer-links"><a class="footer-item" target="_blank" rel="noopener" href="https://chat.liushen.fun/">清羽AI</a><a class="footer-item" target="_blank" rel="noopener" href="https://hot.liushen.fun/">今日热榜</a><a class="footer-item" target="_blank" rel="noopener" href="https://cover.qyliu.top/">封面设计</a><a class="footer-item" target="_blank" rel="noopener" href="https://icon.qyliu.top/">万变图标</a><a class="footer-item" target="_blank" rel="noopener" href="https://tmail.qyliu.top/">临时邮箱</a><a class="footer-item" target="_blank" rel="noopener" href="https://share.liushen.fun/">内容中转</a></div></div><div class="footer-group" id="friend-links-in-footer"><h3 class="footer-title">友链<button title="换一批" href="javascript:;" onclick="liushen.randomLink()"><i class="fa-solid fa-rotate-right"></i></button></h3><div class="footer-links"><a class="footer-item" target="_blank" href="https://blog.liushen.fun">测试1</a><a class="footer-item" target="_blank" href="https://blog.liushen.fun">测试2</a><a class="footer-item" target="_blank" href="https://blog.liushen.fun">测试3</a><a class="footer-item" target="_blank" href="https://blog.liushen.fun">测试4</a><a class="footer-item" target="_blank" href="https://blog.liushen.fun">测试5</a><a class="footer-item" href="/link/" data-pjax-state="data-pjax-state">查看更多</a></div></div></div><div id="footer-bottom"><div class="footer-bottom-content"><div class="footer-bottom-left"><span class="copyright">©2021 - 2025 By <a target="_blank" rel="noopener" href="https://blog.liushen.fun/about/" title="点击访问&quot;LiuShen&quot;的主页" style="margin-left:5px">LiuShen</a></span><div><a class="footer-bottom-link" target="_blank" href="https://beian.miit.gov.cn/" rel="noopener external nofollow" title="工信部备案号">陕ICP备2024028531号-2</a><a class="footer-bottom-link" target="_blank" href="https://beian.mps.gov.cn/#/query/webSearch?code=61011602000637" rel="noopener external nofollow" title="公安备案号">陕公网安备61011602000637号</a></div></div><div class="footer-bottom-right"><div id="runtime" title="本站运行时间">本站已苟活：0 天 0 时 0 分 0 秒</div><div><a class="footer-bottom-link" target="_blank" href="https://www.dogecloud.com/?iuid=9173" rel="noopener external nofollow" title="本站通过多吉云CDN提供站点加速">多吉云CDN</a><a class="footer-bottom-link" target="_blank" href="https://hexo.io/zh-cn/" rel="noopener external nofollow" title="本站使用Hexo架构搭建而成">Hexo静态框架</a><a class="footer-bottom-link" target="_blank" href="https://butterfly.js.org/" rel="noopener external nofollow" title="本站主题由Butterfly主题魔改而成">LiuShen主题</a></div></div></div></div></div><script>window.liushen||(window.liushen={saveData:(e,n)=>{localStorage.setItem(e,JSON.stringify({time:Date.now(),data:n}))},loadData:(e,n)=>{let t=JSON.parse(localStorage.getItem(e));if(t){let e=Date.now()-t.time;if(e>=0&&e<6e4*n)return t.data}return null},runtime:()=>{const e=e=>e>9?e:"0"+e,n=new Date("2021/12/12 01:27:36").getTime(),t=Date.now();let i=Math.round((t-n)/1e3),o="本站已苟活：";i>=86400&&(o+=`${e(Math.floor(i/86400))} 天 `,i%=86400),i>=3600&&(o+=`${e(Math.floor(i/3600))} 时 `,i%=3600),i>=60&&(o+=`${e(Math.floor(i/60))} 分 `,i%=60),o+=`${e(i)} 秒`;const l=document.getElementById("runtime");l&&(l.innerHTML=o),setTimeout(window.liushen.runtime,1e3)},randomLink:()=>{let e=window.liushen.loadData("links",30);if(e){let n=document.querySelectorAll("#friend-links-in-footer .footer-item");if(!n.length)return;for(let t=0;t<n.length;t++){let i=Math.floor(Math.random()*e.length);n[t].innerText=e[i].name,n[t].href=e[i].link,e.splice(i,1)}}else fetch("/flink_count.json").then((e=>e.json())).then((e=>{window.liushen.saveData("links",e.link_list),window.liushen.randomLink()}))}}),window.liushen.randomLink(),document.addEventListener("DOMContentLoaded",window.liushen.randomLink),window.liushen.runtime()</script></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="translateLink" type="button" title="简繁转换" style="width:35px">繁</button><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i><span class="rightside-text">阅读模式</span></button><button id="darkmode" type="button" title="日间和夜间模式切换"><i class="fa-regular fa-star-half-stroke"></i><span class="rightside-text">亮暗切换</span></button><button id="cat" onclick="toggleLive2dVisibility()" title="小猫显隐"><i class="fa-solid fa-cat"></i><span class="rightside-text">小猫显隐</span></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fa-solid fa-arrows-left-right-to-line"></i><span class="rightside-text">侧栏显隐</span></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i><span class="rightside-text">更多设置</span></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i><span class="rightside-text">显示目录</span></button><button id="fullscreen" onclick="toggleFullScreen()" title="全屏切换"><i class="fa-solid fa-expand"></i><span class="rightside-text">全屏切换</span></button><a id="to_comment" href="#post-comment" title="前往评论"><i class="fas fa-comments"></i><span class="rightside-text">快速评论</span></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i><span class="rightside-text">回到顶部</span></button></div></div><div id="rightMenu"><div class="rightMenu-group rightMenu-small"><div class="rightMenu-item" id="menu-backward"><i class="fa-solid fa-arrow-left"></i></div><div class="rightMenu-item" id="menu-forward"><i class="fa-solid fa-arrow-right"></i></div><div class="rightMenu-item" id="menu-refresh"><i class="fa-solid fa-arrow-rotate-right"></i></div><div class="rightMenu-item" id="menu-home"><i class="fa-solid fa-house"></i></div></div><div class="rightMenu-group rightMenu-line hide" id="menu-text"><a class="rightMenu-item" id="copy" href="javascript:rm.copySelect();"><i class="fa-solid fa-copy"></i><span>复制选中文字</span></a><a class="rightMenu-item" id="reply" href="javascript:rm.replySelect();"><i class="fa-regular fa-comment"></i><span>评论选中段落</span></a></div><div class="rightMenu-group rightMenu-line rightMenuOther"><a class="rightMenu-item menu-link" href="/archives/"><i class="fa-solid fa-archive"></i><span>文章时间线</span></a><a class="rightMenu-item menu-link" href="/categories/"><i class="fa-solid fa-folder-open"></i><span>文章分大类</span></a><a class="rightMenu-item menu-link" href="/tags/"><i class="fa-solid fa-tags"></i><span>文章小标签</span></a></div><div class="rightMenu-group rightMenu-line rightMenuNormal"><a class="rightMenu-item menu-link" id="menu-radompage" href="/comment/"><i class="fa-solid fa-shoe-prints"></i><span>随心留言板</span></a><div class="rightMenu-item" id="menu-translate"><i class="fa-solid fa-earth-asia"></i><span>繁简模式切换</span></div><div class="rightMenu-item" id="menu-live2dvisibility"><i class="fa-solid fa-cat"></i><span>小猫显示隐藏</span></div><div class="rightMenu-item" id="menu-print"><i class="fa-solid fa-print fa-fw"></i><span>打印整个页面</span></div><a class="rightMenu-item menu-link" id="statement" href="/statement/"><i class="fa-regular fa-copyright fa-fw"></i><span>网站声明</span></a></div></div><div id="rightmenu-mask"></div><div><script src="/js/others.js?v=5.0.0"></script><script src="/js/utils.js?v=5.0.0"></script><script src="/js/main.js?v=5.0.0"></script><script src="https://jsd.liiiu.cn/npm/echarts@5.5.1/dist/echarts.simple.min.js"></script><script src="/js/rightmenu.js?v=5.0.0"></script><script src="/js/jinrishici.js"></script><script src="/js/tw_cn.js?v=5.0.0"></script><script src="https://jsd.liiiu.cn/npm/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.umd.min.js"></script><script src="https://jsd.liiiu.cn/npm/instant.page@5.2.0/instantpage.min.js" type="module"></script><script src="https://jsd.liiiu.cn/npm/vanilla-lazyload@19.1.3/dist/lazyload.iife.min.js"></script><div class="js-pjax"><script>(()=>{let t=null;const e=null,o="shuoshuo"===GLOBAL_CONFIG_SITE.pageType,a=()=>{t&&(t.destroy(),t=null)},n=e=>t&&t.setDarkMode("dark"===e),l=(l=document,i=location.pathname)=>{t=Artalk.init({el:l.querySelector("#artalk-wrap"),server:"https://atk.liushen.fun",site:"清羽飞扬",darkMode:"dark"===document.documentElement.getAttribute("data-theme"),...e,pageKey:i,imgUploader:function(t){let e="Bearer 28|q18njD3pLtHiFy9WidqQrREwqZzb8Zionr8WzilI",o="https://www.baiwulin.work/api/v1/upload",a=new Headers;a.set("Accept","application/json"),a.set("Authorization",e);let n=new FormData;n.append("file",t);const l=(t,e,o)=>fetch(t,{method:"POST",body:e,headers:o}).then((t=>t.json())).then((t=>t.data.links.url)).catch((t=>(console.error("Image upload failed:",t),null)));return l(o,n,a).then((t=>t||(console.warn("雾林图床接口失败，尝试替换为秋叶图床"),e="Bearer 11|lsReISlSS0dyhDzt35ovtfYefGbWSRW2vvntPXs7",o="https://imgse.koxiuqiu.cc/api/v1/upload",a.set("Authorization",e),l(o,n,a))))}}),"null"!==GLOBAL_CONFIG.lightbox&&(t.on("list-loaded",(()=>{t.ctx.get("list").getCommentNodes().forEach((t=>{const e=t.getRender().$content;btf.loadLightbox(e.querySelectorAll("img:not([atk-emoticon])"))}))})),o&&(window.shuoshuoComment.destroyArtalk=()=>{a(),l.children.length&&(l.innerHTML="",l.classList.add("no-comment"))}),btf.addGlobalFn("pjaxSendOnce",a,"destroyArtalk"),btf.addGlobalFn("themeChange",n,"artalk"))},i=async(t,e)=>{"object"==typeof Artalk||(await btf.getCSS("https://jsd.liiiu.cn/npm/artalk@2.9.1/dist/Artalk.min.css"),await btf.getScript("https://jsd.liiiu.cn/npm/artalk@2.9.1/dist/Artalk.min.js")),l(t,e)};o?window.shuoshuoComment={loadComment:i}:setTimeout(i,0)})()</script></div><script>window.newestComments={changeContent:e=>(""===e||(e=(e=(e=(e=(e=e.replace(/<img.*?src="(.*?)"?[^\>]+>/gi,"[图片]")).replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,"[链接]")).replace(/<pre><code>.*?<\/pre>/gi,"[代码]")).replace(/<code>.*?<\/code>/gi,"[代码]")).replace(/<[^>]+>/g,"")).length>150&&(e=e.substring(0,150)+"..."),e),generateHtml:(e,t)=>{let n="";if(e.length)for(let t=0;t<e.length;t++){if(n+='<div class="aside-list-item">',e[t].avatar){const a="data-lazy-src";n+=`<a href="${e[t].url}" class="thumbnail"><img ${a}="${e[t].avatar}" alt="${e[t].nick}"></a>`}n+=`<div class="content">\n        <a class="comment" href="${e[t].url}" title="${e[t].content}">${e[t].content}</a>\n        <div class="name"><span>${e[t].nick} / </span><time datetime="${e[t].date}">${btf.diffDate(e[t].date,!0)}</time></div>\n        </div></div>`}else n+="暂无评论";t.innerHTML=n,window.lazyLoadInstance&&window.lazyLoadInstance.update(),window.pjax&&window.pjax.refresh(t)},newestCommentInit:(e,t)=>{const n=document.querySelector("#card-newest-comments .aside-list");if(n){const a=btf.saveToLocal.get(e);a?newestComments.generateHtml(JSON.parse(a),n):t(n)}},run:(e,t)=>{newestComments.newestCommentInit(e,t),btf.addGlobalFn("pjaxComplete",(()=>newestComments.newestCommentInit(e,t)),e)}}</script><script>window.addEventListener("load",(()=>{const t="artalk-newest-comments",{changeContent:a,generateHtml:e,run:n}=window.newestComments,r=new URLSearchParams({site_name:"清羽飞扬",limit:"5"});n(t,(async n=>{try{const s=await fetch(`https://atk.liushen.fun/api/v2/stats/latest_comments?${r}`),o=await s.json(),{avatarCdn:c,avatarDefault:i}=await(async()=>{const t=t=>t.startsWith("d=")?t:`d=${t}`;try{const a=await fetch("https://atk.liushen.fun/api/v2/conf"),e=await a.json(),{mirror:n,params:r,default:s}=e.frontend_conf.gravatar;return{avatarCdn:n,avatarDefault:t(r||s)}}catch(a){return console.error(a),{avatarCdn:"",avatarDefault:t("")}}})(),l=o.data.map((t=>({avatar:c&&t.email_encrypted?`${c}${t.email_encrypted}?${i}`:"",content:a(t.content_marked),nick:t.nick,url:t.page_url,date:t.date})));btf.saveToLocal.set(t,JSON.stringify(l),10/1440),e(l,n)}catch(t){console.log(t),n.textContent="无法获取评论，请确认相关配置是否正确"}}))}))</script><script src="/config/memos/memos.js"></script><script id="canvas_nest" defer color="128,128,128" opacity="0.7" zindex="-1" count="99" mobile="false" src="https://jsd.liiiu.cn/npm/butterfly-extsrc@1.1.4/dist/canvas-nest.min.js"></script><link rel="stylesheet" href="https://jsd.liiiu.cn/npm/aplayer@1.10.1/dist/APlayer.min.css" media="print" onload='this.media="all"'><script src="https://jsd.liiiu.cn/npm/aplayer@1.10.1/dist/APlayer.min.js"></script><script src="https://jsd.liiiu.cn/npm/meting@2.0.1/dist/Meting.min.js"></script><script src="https://jsd.liiiu.cn/npm/pjax@0.2.8/pjax.min.js"></script><script>(()=>{window.pjax=new Pjax({elements:'a:not([target="_blank"])',selectors:["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"],cacheBust:!1,analytics:!1,scrollRestoration:!1});const e=e=>{e&&Object.values(e).forEach((e=>e()))};document.addEventListener("pjax:send",(()=>{btf.removeGlobalFnEvent("pjaxSendOnce"),btf.removeGlobalFnEvent("themeChange");const t=document.body.classList;t.contains("read-mode")&&t.remove("read-mode"),e(window.globalFn.pjaxSend)})),document.addEventListener("pjax:complete",(()=>{btf.removeGlobalFnEvent("pjaxCompleteOnce"),document.querySelectorAll("script[data-pjax]").forEach((e=>{const t=document.createElement("script"),n=e.text||e.textContent||e.innerHTML||"";Array.from(e.attributes).forEach((e=>t.setAttribute(e.name,e.value))),t.appendChild(document.createTextNode(n)),e.parentNode.replaceChild(t,e)})),e(window.globalFn.pjaxComplete)})),document.addEventListener("pjax:error",(e=>{404===e.request.status&&pjax.loadUrl("/404")}))})()</script><script async data-pjax="" src="/config/busuanzi/busuanzi.js"></script><div id="algolia-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="search-wrap"><div id="algolia-search-input"></div><hr><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-info"><div class="algolia-stats"></div><div class="algolia-poweredBy"></div></div></div></div></div><div id="search-mask"></div><script src="https://jsd.liiiu.cn/npm/algoliasearch@5.8.1/dist/lite/builds/browser.umd.min.js"></script><script src="https://jsd.liiiu.cn/npm/instantsearch.js@4.75.0/dist/instantsearch.production.min.js"></script><script src="/js/search/algolia.js?v=5.0.0"></script></div></div><div class="needEndHide" id="nav-music"><div id="nav-music-hoverTips" onclick="liuMusic.musicToggle()">音乐已暂停</div><meting-js id="13597135963" server="netease" type="playlist" mutex="true" preload="none" data-lrctype="0" order="random" volume="0.8" api="https://met.liiiu.cn/meting/api?server=:server&amp;type=:type&amp;id=:id&amp;r=:r"></meting-js></div><script data-pjax="">function butterfly_swiper_injector_config(){var a=document.getElementById("recent-posts");console.log("已挂载butterfly_swiper"),a.insertAdjacentHTML("afterbegin",'<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/4bb33804/&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://p.liiiu.cn/i/2025/04/08/67f49876a62e5.webp" alt="" onerror="this.src=/img/error-page.png; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-04-08</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/4bb33804/&quot;);" href="javascript:void(0);" alt="">PaddleYOLO训练自己的数据集</a><div class="blog-slider__text">近期一直在研究毕业设计，在其中，我涉及到了PaddleYOLO的训练和部署，在网上的教程较少，经过不断努力，我也算是跑出来了，所以在这里分享出来做个记录，防止下次使用又忘记了怎么搞。</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/4bb33804/&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/5f71a4b1/&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://p.liiiu.cn/i/2025/04/27/680dc7916ef34.webp" alt="" onerror="this.src=/img/error-page.png; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-04-28</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/5f71a4b1/&quot;);" href="javascript:void(0);" alt="">耗子面板和DPanel简单体验</a><div class="blog-slider__text">最近毕业设计临近尾声，代码也敲完了，目前就剩稍微的调优，就可以开始写论文啦！在闲暇时间，我也尝试部署了一些不一样的面板程序，总感觉1panel稍微有些复杂，很多功能并用不上，比如GPU，下面简单分享一下我的体验。</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/5f71a4b1/&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/40702a0d/&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://p.liiiu.cn/i/2025/05/06/6819cd4532457.webp" alt="" onerror="this.src=/img/error-page.png; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-05-07</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/40702a0d/&quot;);" href="javascript:void(0);" alt="">本地实现HEXO文章AI摘要</a><div class="blog-slider__text">五一假期结束啦！这五天啥也没干，就在宿舍敲代码，都快无聊死了，恰逢找到了一些免费API，就自己实现一个AI摘要吧！利用API生成摘要文本放在文章头部，再通过hexo进行渲染就好啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/40702a0d/&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/7915ee6b/&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://p.liiiu.cn/i/2025/05/25/6832cc105bc41.webp" alt="" onerror="this.src=/img/error-page.png; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-05-25</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/7915ee6b/&quot;);" href="javascript:void(0);" alt="">数据库可视化WEB工具对比</a><div class="blog-slider__text">最近迁移服务器，并且搞了一个1P专业版玩玩，感觉效果很不错，想找一个管理数据库的服务，其中看了phpmyadmin等一些知名项目，但是都不太符合我的要求，最后经过筛选，找到了比较合适的，分享给大家！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/7915ee6b/&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/caee2d9f/&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://p.liiiu.cn/i/2025/04/18/68024a618942b.webp" alt="" onerror="this.src=/img/error-page.png; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-04-18</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/caee2d9f/&quot;);" href="javascript:void(0);" alt="">美化你的RSS订阅地址</a><div class="blog-slider__text">近期天天忙着毕业设计，冷落了站点文章的更新，最近也终于算是快要搞完了，于是开始捣鼓一些好玩的东西，在浏览阮一峰大佬的周刊时，了解到了RSS也能美化，折腾了一下，没想到还真实现了，在此分享一下。</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/caee2d9f/&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>')}for(var elist="null".split(","),cpage=location.pathname,epage="/",flag=0,i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&butterfly_swiper_injector_config()</script><script defer src="https://jsd.liiiu.cn/npm/swiper@11.1.14/swiper-bundle.min.js"></script><script defer data-pjax="" src="/config/swiper/swiper_init.js"></script><script src="https://jsd.liiiu.cn/npm/live2d-widget@^3.1.3/lib/L2Dwidget.min.js"></script><script>L2Dwidget.init({pluginModelPath:"assets/",model:{scale:1,hHeadPos:.5,vHeadPos:.618,jsonPath:"/live2dw/assets/tororo.model.json"},display:{superSample:2,width:250,height:500,position:"left",hOffset:-20,vOffset:-90},mobile:{show:!1,scale:.5},react:{opacityDefault:.7,opacityOnHover:.2},log:!1,pluginJsPath:"lib/",pluginRootPath:"live2dw/",tagMode:!1})</script></body></html>